-
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
[Dataset Quality] Optimize bundle size and chunks fragmentation #194661
[Dataset Quality] Optimize bundle size and chunks fragmentation #194661
Conversation
const Header = dynamic(() => import('./header')); | ||
const Warnings = dynamic(() => import('./warnings/warnings')); | ||
const EmptyStateWrapper = dynamic(() => import('./empty_state/empty_state')); | ||
const Table = dynamic(() => import('./table/table')); | ||
const Filters = dynamic(() => import('./filters/filters')); | ||
const SummaryPanel = dynamic(() => import('./summary_panel/summary_panel')); |
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.
Note
All of these chunks were loaded in parallel when loading the page, causing an excessive fragmentation for a UI that can loaded at once.
The lazy loading now happens for the main chunk on the index file, where the getter dynamically import the whole UI island.
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.
to better understand what happened here:
Should we use this approach then only for elements in the UI that are showed after some interaction? for example a flyout?
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.
Sort of, the best way to think about this is to split only when we might not need something.
For instance, in the above case we were splitting into 6 chunks sections of the same page that are always immediately loaded when the page is visited. In this case we could consider it as a single "UI island" that can be dynamically loaded at once, reducing the back and forth with the server.
The flyout example you are doing is a good one, as the user might never open the flyout during a session.
Pinging @elastic/obs-ux-logs-team (Team:obs-ux-logs) |
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 for these changes 🚀
💛 Build succeeded, but was flaky
Failed CI StepsTest FailuresMetrics [docs]Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
async chunk count
History
To update your PR or re-run it, just comment with: |
Starting backport for target branches: 8.x |
…tic#194661) ## 📓 Summary Closes elastic#191602 This work reduces the initial bundle size for the dataset quality plugin by **~55%** and reduces fragmentation in the chunks when the main page loads. | Before | After | |--------|--------| | <img width="525" alt="Screenshot 2024-10-02 at 09 56 35" src="https://github.com/user-attachments/assets/06fec02c-ff2c-4771-981f-a761bda67eae"> | <img width="521" alt="Screenshot 2024-10-02 at 09 59 16" src="https://github.com/user-attachments/assets/a243b09a-9d83-4d0d-b875-20855bb18f5d"> | | <img width="1398" alt="Screenshot 2024-10-02 at 09 56 55" src="https://github.com/user-attachments/assets/66d2c131-b0b7-47e1-9a9a-e1be57e69bbb"> | <img width="678" alt="Screenshot 2024-10-02 at 09 58 59" src="https://github.com/user-attachments/assets/39e6515e-5a83-4d97-97c8-cce01b7c6887"> | Co-authored-by: Marco Antonio Ghiani <[email protected]> (cherry picked from commit ce8c9d8)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…#194661) (#194746) # Backport This will backport the following commits from `main` to `8.x`: - [[Dataset Quality] Optimize bundle size and chunks fragmentation (#194661)](#194661) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Marco Antonio Ghiani","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-02T16:37:04Z","message":"[Dataset Quality] Optimize bundle size and chunks fragmentation (#194661)\n\n## 📓 Summary\r\n\r\nCloses #191602 \r\n\r\nThis work reduces the initial bundle size for the dataset quality plugin\r\nby **~55%** and reduces fragmentation in the chunks when the main page\r\nloads.\r\n\r\n| Before | After |\r\n|--------|--------|\r\n| <img width=\"525\" alt=\"Screenshot 2024-10-02 at 09 56 35\"\r\nsrc=\"https://github.com/user-attachments/assets/06fec02c-ff2c-4771-981f-a761bda67eae\">\r\n| <img width=\"521\" alt=\"Screenshot 2024-10-02 at 09 59 16\"\r\nsrc=\"https://github.com/user-attachments/assets/a243b09a-9d83-4d0d-b875-20855bb18f5d\">\r\n|\r\n| <img width=\"1398\" alt=\"Screenshot 2024-10-02 at 09 56 55\"\r\nsrc=\"https://github.com/user-attachments/assets/66d2c131-b0b7-47e1-9a9a-e1be57e69bbb\">\r\n| <img width=\"678\" alt=\"Screenshot 2024-10-02 at 09 58 59\"\r\nsrc=\"https://github.com/user-attachments/assets/39e6515e-5a83-4d97-97c8-cce01b7c6887\">\r\n|\r\n\r\nCo-authored-by: Marco Antonio Ghiani <[email protected]>","sha":"ce8c9d8d63ac8d67e975f4cd15cdb665a064d67e","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-logs"],"title":"[Dataset Quality] Optimize bundle size and chunks fragmentation","number":194661,"url":"https://github.com/elastic/kibana/pull/194661","mergeCommit":{"message":"[Dataset Quality] Optimize bundle size and chunks fragmentation (#194661)\n\n## 📓 Summary\r\n\r\nCloses #191602 \r\n\r\nThis work reduces the initial bundle size for the dataset quality plugin\r\nby **~55%** and reduces fragmentation in the chunks when the main page\r\nloads.\r\n\r\n| Before | After |\r\n|--------|--------|\r\n| <img width=\"525\" alt=\"Screenshot 2024-10-02 at 09 56 35\"\r\nsrc=\"https://github.com/user-attachments/assets/06fec02c-ff2c-4771-981f-a761bda67eae\">\r\n| <img width=\"521\" alt=\"Screenshot 2024-10-02 at 09 59 16\"\r\nsrc=\"https://github.com/user-attachments/assets/a243b09a-9d83-4d0d-b875-20855bb18f5d\">\r\n|\r\n| <img width=\"1398\" alt=\"Screenshot 2024-10-02 at 09 56 55\"\r\nsrc=\"https://github.com/user-attachments/assets/66d2c131-b0b7-47e1-9a9a-e1be57e69bbb\">\r\n| <img width=\"678\" alt=\"Screenshot 2024-10-02 at 09 58 59\"\r\nsrc=\"https://github.com/user-attachments/assets/39e6515e-5a83-4d97-97c8-cce01b7c6887\">\r\n|\r\n\r\nCo-authored-by: Marco Antonio Ghiani <[email protected]>","sha":"ce8c9d8d63ac8d67e975f4cd15cdb665a064d67e"}},"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/194661","number":194661,"mergeCommit":{"message":"[Dataset Quality] Optimize bundle size and chunks fragmentation (#194661)\n\n## 📓 Summary\r\n\r\nCloses #191602 \r\n\r\nThis work reduces the initial bundle size for the dataset quality plugin\r\nby **~55%** and reduces fragmentation in the chunks when the main page\r\nloads.\r\n\r\n| Before | After |\r\n|--------|--------|\r\n| <img width=\"525\" alt=\"Screenshot 2024-10-02 at 09 56 35\"\r\nsrc=\"https://github.com/user-attachments/assets/06fec02c-ff2c-4771-981f-a761bda67eae\">\r\n| <img width=\"521\" alt=\"Screenshot 2024-10-02 at 09 59 16\"\r\nsrc=\"https://github.com/user-attachments/assets/a243b09a-9d83-4d0d-b875-20855bb18f5d\">\r\n|\r\n| <img width=\"1398\" alt=\"Screenshot 2024-10-02 at 09 56 55\"\r\nsrc=\"https://github.com/user-attachments/assets/66d2c131-b0b7-47e1-9a9a-e1be57e69bbb\">\r\n| <img width=\"678\" alt=\"Screenshot 2024-10-02 at 09 58 59\"\r\nsrc=\"https://github.com/user-attachments/assets/39e6515e-5a83-4d97-97c8-cce01b7c6887\">\r\n|\r\n\r\nCo-authored-by: Marco Antonio Ghiani <[email protected]>","sha":"ce8c9d8d63ac8d67e975f4cd15cdb665a064d67e"}}]}] BACKPORT--> Co-authored-by: Marco Antonio Ghiani <[email protected]>
📓 Summary
Closes #191602
This work reduces the initial bundle size for the dataset quality plugin by ~55% and reduces fragmentation in the chunks when the main page loads.