-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Discover] Enhance Discover loading time by parallel execution of requests #195670
Conversation
hasESData: true, | ||
hasUserDataView: true, | ||
showNoDataPage: false, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit of optimization, so let setState
is being called, this will lead to less re-renderings, however those are just small wins
const [hasUserDataViewValue, hasESDataValue, defaultDataViewExists] = await Promise.all([ | ||
data.dataViews.hasData.hasUserDataView().catch(() => false), | ||
data.dataViews.hasData.hasESData().catch(() => false), | ||
data.dataViews.defaultDataViewExists().catch(() => false), | ||
await stateContainer.actions.loadDataViewList(), | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the main improvement. Execution in parallel is beneficial for loading performance
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
Flaky Test Runner Stats🎉 All tests passed! - kibana-flaky-test-suite-runner#7120[✅] test/functional/apps/discover/group5/config.ts: 25/25 tests passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactoring and performance improvement!
Leaving some questions.
src/plugins/discover/public/application/main/discover_main_route.tsx
Outdated
Show resolved
Hide resolved
src/plugins/discover/public/application/main/discover_main_route.tsx
Outdated
Show resolved
Hide resolved
src/plugins/discover/public/application/main/discover_main_route.tsx
Outdated
Show resolved
Hide resolved
…te.tsx Co-authored-by: Julia Rechkunova <[email protected]>
…te.tsx Co-authored-by: Julia Rechkunova <[email protected]>
…te.tsx Co-authored-by: Julia Rechkunova <[email protected]>
💚 Build Succeeded
Metrics [docs]Async chunks
History
cc @kertal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! 👍
Starting backport for target branches: 8.x |
…uests (elastic#195670) In the loading process of Discover, there were 4 sequential requests. This commit refactors the code to execute them in a parallel way. Before theduration of requests were adding up, now it takes as long as the longest request. This can speed up the loading Discover significantly, depending on how long those requests take. Co-authored-by: Julia Rechkunova <[email protected]> (cherry picked from commit dc1aced)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…of requests (#195670) (#195939) # Backport This will backport the following commits from `main` to `8.x`: - [[Discover] Enhance Discover loading time by parallel execution of requests (#195670)](#195670) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Matthias Wilhelm","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-11T14:47:50Z","message":"[Discover] Enhance Discover loading time by parallel execution of requests (#195670)\n\nIn the loading process of Discover, there were 4 sequential requests. This commit refactors the code to execute them in a parallel way. Before theduration of requests were adding up, now it takes as long as the longest\r\nrequest. This can speed up the loading Discover significantly, depending on how long those requests take.\r\n\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"dc1aced57d238324b48496e64c5fb8a5a9e9dcd3","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Discover","performance","release_note:skip","v9.0.0","Team:DataDiscovery","backport:prev-minor","Project:OneDiscover"],"title":"[Discover] Enhance Discover loading time by parallel execution of requests","number":195670,"url":"https://github.com/elastic/kibana/pull/195670","mergeCommit":{"message":"[Discover] Enhance Discover loading time by parallel execution of requests (#195670)\n\nIn the loading process of Discover, there were 4 sequential requests. This commit refactors the code to execute them in a parallel way. Before theduration of requests were adding up, now it takes as long as the longest\r\nrequest. This can speed up the loading Discover significantly, depending on how long those requests take.\r\n\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"dc1aced57d238324b48496e64c5fb8a5a9e9dcd3"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195670","number":195670,"mergeCommit":{"message":"[Discover] Enhance Discover loading time by parallel execution of requests (#195670)\n\nIn the loading process of Discover, there were 4 sequential requests. This commit refactors the code to execute them in a parallel way. Before theduration of requests were adding up, now it takes as long as the longest\r\nrequest. This can speed up the loading Discover significantly, depending on how long those requests take.\r\n\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"dc1aced57d238324b48496e64c5fb8a5a9e9dcd3"}}]}] BACKPORT--> Co-authored-by: Matthias Wilhelm <[email protected]>
- Closes #199065 ## Summary This PR makes sure that data views are loaded so user can view them after switching from ES|QL mode to data view mode. Looks like it was introduced in #195670 ### Testing On your local instance having `kibana_sample_data_logs` installed * Open a link to an ES|QL query [link](http://localhost:5601/xot/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-15m,to:now))&_a=(columns:!(),dataSource:(dataViewId:e3465e67bdeced2befff9f9dca7ecf9c48504cad68a10efd881f4c7dd5ade28a,type:dataView),filters:!(),interval:auto,query:(language:kuery,query:''),sort:!(!(timestamp,desc)))) * Switch to classic * Open the DataView Picker, to see a list of DataViews, before this fix there were none ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Julia Rechkunova <[email protected]> Co-authored-by: Julia Rechkunova <[email protected]>
- Closes elastic#199065 ## Summary This PR makes sure that data views are loaded so user can view them after switching from ES|QL mode to data view mode. Looks like it was introduced in elastic#195670 ### Testing On your local instance having `kibana_sample_data_logs` installed * Open a link to an ES|QL query [link](http://localhost:5601/xot/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-15m,to:now))&_a=(columns:!(),dataSource:(dataViewId:e3465e67bdeced2befff9f9dca7ecf9c48504cad68a10efd881f4c7dd5ade28a,type:dataView),filters:!(),interval:auto,query:(language:kuery,query:''),sort:!(!(timestamp,desc)))) * Switch to classic * Open the DataView Picker, to see a list of DataViews, before this fix there were none ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Julia Rechkunova <[email protected]> Co-authored-by: Julia Rechkunova <[email protected]> (cherry picked from commit 08b83c5)
- Closes elastic#199065 ## Summary This PR makes sure that data views are loaded so user can view them after switching from ES|QL mode to data view mode. Looks like it was introduced in elastic#195670 ### Testing On your local instance having `kibana_sample_data_logs` installed * Open a link to an ES|QL query [link](http://localhost:5601/xot/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-15m,to:now))&_a=(columns:!(),dataSource:(dataViewId:e3465e67bdeced2befff9f9dca7ecf9c48504cad68a10efd881f4c7dd5ade28a,type:dataView),filters:!(),interval:auto,query:(language:kuery,query:''),sort:!(!(timestamp,desc)))) * Switch to classic * Open the DataView Picker, to see a list of DataViews, before this fix there were none ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Julia Rechkunova <[email protected]> Co-authored-by: Julia Rechkunova <[email protected]> (cherry picked from commit 08b83c5)
) # Backport This will backport the following commits from `main` to `8.x`: - [[Discover] Fix loading data views in ES|QL mode (#199099)](#199099) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Matthias Wilhelm","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-06T18:13:33Z","message":"[Discover] Fix loading data views in ES|QL mode (#199099)\n\n- Closes https://github.com/elastic/kibana/issues/199065\r\n\r\n## Summary\r\n\r\nThis PR makes sure that data views are loaded so user can view them\r\nafter switching from ES|QL mode to data view mode.\r\n\r\nLooks like it was introduced in\r\nhttps://github.com//pull/195670\r\n\r\n### Testing\r\n\r\nOn your local instance having `kibana_sample_data_logs` installed\r\n\r\n* Open a link to an ES|QL query\r\n[link](http://localhost:5601/xot/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-15m,to:now))&_a=(columns:!(),dataSource:(dataViewId:e3465e67bdeced2befff9f9dca7ecf9c48504cad68a10efd881f4c7dd5ade28a,type:dataView),filters:!(),interval:auto,query:(language:kuery,query:''),sort:!(!(timestamp,desc))))\r\n* Switch to classic\r\n* Open the DataView Picker, to see a list of DataViews, before this fix\r\nthere were none\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Julia Rechkunova <[email protected]>\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"08b83c55f64bc250a4b6d5909cfc2e46003e9751","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Discover","release_note:skip","v9.0.0","Team:DataDiscovery","v8.16.0","backport:version","v8.17.0"],"title":"[Discover] Fix loading data views in ES|QL mode","number":199099,"url":"https://github.com/elastic/kibana/pull/199099","mergeCommit":{"message":"[Discover] Fix loading data views in ES|QL mode (#199099)\n\n- Closes https://github.com/elastic/kibana/issues/199065\r\n\r\n## Summary\r\n\r\nThis PR makes sure that data views are loaded so user can view them\r\nafter switching from ES|QL mode to data view mode.\r\n\r\nLooks like it was introduced in\r\nhttps://github.com//pull/195670\r\n\r\n### Testing\r\n\r\nOn your local instance having `kibana_sample_data_logs` installed\r\n\r\n* Open a link to an ES|QL query\r\n[link](http://localhost:5601/xot/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-15m,to:now))&_a=(columns:!(),dataSource:(dataViewId:e3465e67bdeced2befff9f9dca7ecf9c48504cad68a10efd881f4c7dd5ade28a,type:dataView),filters:!(),interval:auto,query:(language:kuery,query:''),sort:!(!(timestamp,desc))))\r\n* Switch to classic\r\n* Open the DataView Picker, to see a list of DataViews, before this fix\r\nthere were none\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Julia Rechkunova <[email protected]>\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"08b83c55f64bc250a4b6d5909cfc2e46003e9751"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199099","number":199099,"mergeCommit":{"message":"[Discover] Fix loading data views in ES|QL mode (#199099)\n\n- Closes https://github.com/elastic/kibana/issues/199065\r\n\r\n## Summary\r\n\r\nThis PR makes sure that data views are loaded so user can view them\r\nafter switching from ES|QL mode to data view mode.\r\n\r\nLooks like it was introduced in\r\nhttps://github.com//pull/195670\r\n\r\n### Testing\r\n\r\nOn your local instance having `kibana_sample_data_logs` installed\r\n\r\n* Open a link to an ES|QL query\r\n[link](http://localhost:5601/xot/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-15m,to:now))&_a=(columns:!(),dataSource:(dataViewId:e3465e67bdeced2befff9f9dca7ecf9c48504cad68a10efd881f4c7dd5ade28a,type:dataView),filters:!(),interval:auto,query:(language:kuery,query:''),sort:!(!(timestamp,desc))))\r\n* Switch to classic\r\n* Open the DataView Picker, to see a list of DataViews, before this fix\r\nthere were none\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Julia Rechkunova <[email protected]>\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"08b83c55f64bc250a4b6d5909cfc2e46003e9751"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Matthias Wilhelm <[email protected]>
…9206) # Backport This will backport the following commits from `main` to `8.16`: - [[Discover] Fix loading data views in ES|QL mode (#199099)](#199099) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Matthias Wilhelm","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-06T18:13:33Z","message":"[Discover] Fix loading data views in ES|QL mode (#199099)\n\n- Closes https://github.com/elastic/kibana/issues/199065\r\n\r\n## Summary\r\n\r\nThis PR makes sure that data views are loaded so user can view them\r\nafter switching from ES|QL mode to data view mode.\r\n\r\nLooks like it was introduced in\r\nhttps://github.com//pull/195670\r\n\r\n### Testing\r\n\r\nOn your local instance having `kibana_sample_data_logs` installed\r\n\r\n* Open a link to an ES|QL query\r\n[link](http://localhost:5601/xot/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-15m,to:now))&_a=(columns:!(),dataSource:(dataViewId:e3465e67bdeced2befff9f9dca7ecf9c48504cad68a10efd881f4c7dd5ade28a,type:dataView),filters:!(),interval:auto,query:(language:kuery,query:''),sort:!(!(timestamp,desc))))\r\n* Switch to classic\r\n* Open the DataView Picker, to see a list of DataViews, before this fix\r\nthere were none\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Julia Rechkunova <[email protected]>\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"08b83c55f64bc250a4b6d5909cfc2e46003e9751","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Discover","release_note:skip","v9.0.0","Team:DataDiscovery","v8.16.0","backport:version","v8.17.0"],"title":"[Discover] Fix loading data views in ES|QL mode","number":199099,"url":"https://github.com/elastic/kibana/pull/199099","mergeCommit":{"message":"[Discover] Fix loading data views in ES|QL mode (#199099)\n\n- Closes https://github.com/elastic/kibana/issues/199065\r\n\r\n## Summary\r\n\r\nThis PR makes sure that data views are loaded so user can view them\r\nafter switching from ES|QL mode to data view mode.\r\n\r\nLooks like it was introduced in\r\nhttps://github.com//pull/195670\r\n\r\n### Testing\r\n\r\nOn your local instance having `kibana_sample_data_logs` installed\r\n\r\n* Open a link to an ES|QL query\r\n[link](http://localhost:5601/xot/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-15m,to:now))&_a=(columns:!(),dataSource:(dataViewId:e3465e67bdeced2befff9f9dca7ecf9c48504cad68a10efd881f4c7dd5ade28a,type:dataView),filters:!(),interval:auto,query:(language:kuery,query:''),sort:!(!(timestamp,desc))))\r\n* Switch to classic\r\n* Open the DataView Picker, to see a list of DataViews, before this fix\r\nthere were none\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Julia Rechkunova <[email protected]>\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"08b83c55f64bc250a4b6d5909cfc2e46003e9751"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199099","number":199099,"mergeCommit":{"message":"[Discover] Fix loading data views in ES|QL mode (#199099)\n\n- Closes https://github.com/elastic/kibana/issues/199065\r\n\r\n## Summary\r\n\r\nThis PR makes sure that data views are loaded so user can view them\r\nafter switching from ES|QL mode to data view mode.\r\n\r\nLooks like it was introduced in\r\nhttps://github.com//pull/195670\r\n\r\n### Testing\r\n\r\nOn your local instance having `kibana_sample_data_logs` installed\r\n\r\n* Open a link to an ES|QL query\r\n[link](http://localhost:5601/xot/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-15m,to:now))&_a=(columns:!(),dataSource:(dataViewId:e3465e67bdeced2befff9f9dca7ecf9c48504cad68a10efd881f4c7dd5ade28a,type:dataView),filters:!(),interval:auto,query:(language:kuery,query:''),sort:!(!(timestamp,desc))))\r\n* Switch to classic\r\n* Open the DataView Picker, to see a list of DataViews, before this fix\r\nthere were none\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Julia Rechkunova <[email protected]>\r\nCo-authored-by: Julia Rechkunova <[email protected]>","sha":"08b83c55f64bc250a4b6d5909cfc2e46003e9751"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Matthias Wilhelm <[email protected]>
- Closes elastic#199065 ## Summary This PR makes sure that data views are loaded so user can view them after switching from ES|QL mode to data view mode. Looks like it was introduced in elastic#195670 ### Testing On your local instance having `kibana_sample_data_logs` installed * Open a link to an ES|QL query [link](http://localhost:5601/xot/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-15m,to:now))&_a=(columns:!(),dataSource:(dataViewId:e3465e67bdeced2befff9f9dca7ecf9c48504cad68a10efd881f4c7dd5ade28a,type:dataView),filters:!(),interval:auto,query:(language:kuery,query:''),sort:!(!(timestamp,desc)))) * Switch to classic * Open the DataView Picker, to see a list of DataViews, before this fix there were none ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Julia Rechkunova <[email protected]> Co-authored-by: Julia Rechkunova <[email protected]>
Resolves #195732
Summary
In the loading process of Kibana, there were 4 sequential requests. This PR refactors the code to execute them in a parallel way. Before the duration of requests were adding up, now it takes as long as the longest request. This can speed up the loading Discover significantly, depending on how long those requests take.
Here's an example, simulating a low 4G network, it now takes 0.6s to complete the queries for data/dataviews
Before this change it took 2.4s
Testing
Everything should work like before, except when simulating slow network conditions, loading Discover by e.g. switching from Home, should be much faster. Overall loading experience of Discover also improves.
Checklist