Skip to content
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

[ML] AIOps: Optimize initial load bundles. #198786

Merged
merged 5 commits into from
Nov 8, 2024

Conversation

walterra
Copy link
Contributor

@walterra walterra commented Nov 4, 2024

Summary

Part of #194171.

The AIOps plugin loads quite some bundle chunks on the first Kibana load. On main it currently looks like this on page load:

CleanShot 2024-11-04 at 14 56 52@2x

This means while the aiops.plugin.js bundle has just 10KB, we load 290KB in total via async bundles on every Kibana full page load.

This PR refactors how embeddables and UI actions get initialized to avoid loading any additional async bundles on page load. This increases aiops.plugin.js to ~15KB, but gets rid of all the rest!

CleanShot 2024-11-04 at 15 02 10@2x

Checklist

@walterra walterra self-assigned this Nov 4, 2024
@walterra walterra marked this pull request as ready for review November 5, 2024 11:09
@walterra walterra requested review from a team as code owners November 5, 2024 11:09
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@walterra walterra added release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels Feature:ML/AIOps ML AIOps features: Change Point Detection, Log Pattern Analysis, Log Rate Analysis labels Nov 5, 2024
Copy link
Member

@jbudz jbudz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packages/kbn-optimizer/limits.yml

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
aiops 590.1KB 585.2KB -4.9KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
aiops 8.4KB 15.6KB +7.2KB
Unknown metric groups

async chunk count

id before after diff
aiops 34 37 +3

History

cc @walterra

@walterra walterra merged commit 33c303d into elastic:main Nov 8, 2024
27 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11742814386

@walterra walterra deleted the ml-aiops-optimize-bundles branch November 8, 2024 13:15
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 8, 2024
## Summary

Part of elastic#194171.

The AIOps plugin loads quite some bundle chunks on the first Kibana
load. On main it currently looks like this on page load:

![CleanShot 2024-11-04 at 14 56
52@2x](https://github.com/user-attachments/assets/cbabeaa2-848c-4970-aea5-b06befed0bec)

This means while the `aiops.plugin.js` bundle has just 10KB, we load
290KB in total via async bundles on every Kibana full page load.

This PR refactors how embeddables and UI actions get initialized to
avoid loading any additional async bundles on page load. This increases
`aiops.plugin.js` to ~15KB, but gets rid of all the rest!

![CleanShot 2024-11-04 at 15 02
10@2x](https://github.com/user-attachments/assets/557e240f-2c1c-434d-a936-dddb11ab68b6)

### Checklist

- [ ] [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)

(cherry picked from commit 33c303d)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

rbrtj pushed a commit to rbrtj/kibana that referenced this pull request Nov 8, 2024
Part of elastic#194171.

The AIOps plugin loads quite some bundle chunks on the first Kibana
load. On main it currently looks like this on page load:

![CleanShot 2024-11-04 at 14 56
52@2x](https://github.com/user-attachments/assets/cbabeaa2-848c-4970-aea5-b06befed0bec)

This means while the `aiops.plugin.js` bundle has just 10KB, we load
290KB in total via async bundles on every Kibana full page load.

This PR refactors how embeddables and UI actions get initialized to
avoid loading any additional async bundles on page load. This increases
`aiops.plugin.js` to ~15KB, but gets rid of all the rest!

![CleanShot 2024-11-04 at 15 02
10@2x](https://github.com/user-attachments/assets/557e240f-2c1c-434d-a936-dddb11ab68b6)

- [ ] [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
kibanamachine added a commit that referenced this pull request Nov 8, 2024
# Backport

This will backport the following commits from `main` to `8.x`:
- [[ML] AIOps: Optimize initial load bundles.
(#198786)](#198786)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Walter
Rafelsberger","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-08T13:14:41Z","message":"[ML]
AIOps: Optimize initial load bundles. (#198786)\n\n##
Summary\r\n\r\nPart of
https://github.com/elastic/kibana/issues/194171.\r\n\r\nThe AIOps plugin
loads quite some bundle chunks on the first Kibana\r\nload. On main it
currently looks like this on page load:\r\n\r\n![CleanShot 2024-11-04 at
14
56\r\n52@2x](https://github.com/user-attachments/assets/cbabeaa2-848c-4970-aea5-b06befed0bec)\r\n\r\nThis
means while the `aiops.plugin.js` bundle has just 10KB, we load\r\n290KB
in total via async bundles on every Kibana full page load.\r\n\r\nThis
PR refactors how embeddables and UI actions get initialized to\r\navoid
loading any additional async bundles on page load. This
increases\r\n`aiops.plugin.js` to ~15KB, but gets rid of all the
rest!\r\n\r\n![CleanShot 2024-11-04 at 15
02\r\n10@2x](https://github.com/user-attachments/assets/557e240f-2c1c-434d-a936-dddb11ab68b6)\r\n\r\n###
Checklist\r\n\r\n- [ ] [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- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] This was checked for breaking
API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)","sha":"33c303df2b8257546507b60d847c235920e70e48","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","release_note:skip","v9.0.0","Feature:ML/AIOps","backport:version","v8.17.0"],"title":"[ML]
AIOps: Optimize initial load
bundles.","number":198786,"url":"https://github.com/elastic/kibana/pull/198786","mergeCommit":{"message":"[ML]
AIOps: Optimize initial load bundles. (#198786)\n\n##
Summary\r\n\r\nPart of
https://github.com/elastic/kibana/issues/194171.\r\n\r\nThe AIOps plugin
loads quite some bundle chunks on the first Kibana\r\nload. On main it
currently looks like this on page load:\r\n\r\n![CleanShot 2024-11-04 at
14
56\r\n52@2x](https://github.com/user-attachments/assets/cbabeaa2-848c-4970-aea5-b06befed0bec)\r\n\r\nThis
means while the `aiops.plugin.js` bundle has just 10KB, we load\r\n290KB
in total via async bundles on every Kibana full page load.\r\n\r\nThis
PR refactors how embeddables and UI actions get initialized to\r\navoid
loading any additional async bundles on page load. This
increases\r\n`aiops.plugin.js` to ~15KB, but gets rid of all the
rest!\r\n\r\n![CleanShot 2024-11-04 at 15
02\r\n10@2x](https://github.com/user-attachments/assets/557e240f-2c1c-434d-a936-dddb11ab68b6)\r\n\r\n###
Checklist\r\n\r\n- [ ] [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- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] This was checked for breaking
API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)","sha":"33c303df2b8257546507b60d847c235920e70e48"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198786","number":198786,"mergeCommit":{"message":"[ML]
AIOps: Optimize initial load bundles. (#198786)\n\n##
Summary\r\n\r\nPart of
https://github.com/elastic/kibana/issues/194171.\r\n\r\nThe AIOps plugin
loads quite some bundle chunks on the first Kibana\r\nload. On main it
currently looks like this on page load:\r\n\r\n![CleanShot 2024-11-04 at
14
56\r\n52@2x](https://github.com/user-attachments/assets/cbabeaa2-848c-4970-aea5-b06befed0bec)\r\n\r\nThis
means while the `aiops.plugin.js` bundle has just 10KB, we load\r\n290KB
in total via async bundles on every Kibana full page load.\r\n\r\nThis
PR refactors how embeddables and UI actions get initialized to\r\navoid
loading any additional async bundles on page load. This
increases\r\n`aiops.plugin.js` to ~15KB, but gets rid of all the
rest!\r\n\r\n![CleanShot 2024-11-04 at 15
02\r\n10@2x](https://github.com/user-attachments/assets/557e240f-2c1c-434d-a936-dddb11ab68b6)\r\n\r\n###
Checklist\r\n\r\n- [ ] [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- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] This was checked for breaking
API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)","sha":"33c303df2b8257546507b60d847c235920e70e48"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Walter Rafelsberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:version Backport to applied version labels Feature:ML/AIOps ML AIOps features: Change Point Detection, Log Pattern Analysis, Log Rate Analysis :ml release_note:skip Skip the PR/issue when compiling release notes v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants