Skip to content

[Operations] Tighten page load bundle size limits#227742

Merged
mbondyra merged 5 commits intoelastic:mainfrom
mbondyra:limits/update_limit_to_target_limits_to_high
Jul 14, 2025
Merged

[Operations] Tighten page load bundle size limits#227742
mbondyra merged 5 commits intoelastic:mainfrom
mbondyra:limits/update_limit_to_target_limits_to_high

Conversation

@mbondyra
Copy link
Contributor

@mbondyra mbondyra commented Jul 12, 2025

Summary

Hi Operations team! 👋

Recently I've worked on a few PRs that reduce our page load bundle size, and while doing so I noticed that many of our limits are much higher than the actual page load sizes. It made me think: these limits should be realistic, because they’re one of the main ways we protect page load performance.
Right now, based on the current limits, we theoretically allow up to 11,452,104 bytes (~11 MB) to load upfront. But when we check the real page load, it’s only 5.192.979 bytes — about half of that.

We already have a --update-limits flag for the node scripts/build_kibana_platform_plugins.js --update-limits command, but it only bumps limits up when the size grows above the limit, adding a flat 15 KB buffer to the bundle size.
I’d like to propose:

  1. Allowing the --update-limits to allow folks to also lower limits when the bundle shrinks drastically
  2. Replacing the flat 15 KB buffer with 10% of the plugin’s size, so the buffer scales realistically. Right now, with ~197 plugins, --update-limits allows for an extra (15KB*197=) 3 MB above the total page size — which is way too much in my opinion!

What’s in this PR

✅ Adds logic to let us lower limits automatically, not just bump them up with node scripts/build_kibana_platform_plugins.js --update-limits
✅ Replaces the flat +15 KB bump with a 10% buffer relative to each plugin’s size when using node scripts/build_kibana_platform_plugins.js --update-limits
✅ Updated the limits.yml with the result from the above script

Why it matters

  1. Keeps bundle sizes tight
  2. Protects us from accidental regressions
@mbondyra mbondyra added Team:Operations Kibana-Operations Team release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting v9.2.0 labels Jul 12, 2025
@mbondyra mbondyra requested a review from a team as a code owner July 12, 2025 13:52
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@mbondyra mbondyra force-pushed the limits/update_limit_to_target_limits_to_high branch from 8c01bf9 to b9702f0 Compare July 12, 2025 14:16
@mbondyra mbondyra force-pushed the limits/update_limit_to_target_limits_to_high branch from b9702f0 to dc14d9c Compare July 12, 2025 14:22
@elastic elastic deleted a comment from elasticmachine Jul 12, 2025
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

@mbondyra mbondyra merged commit 5ffee57 into elastic:main Jul 14, 2025
11 of 12 checks passed
@mbondyra mbondyra deleted the limits/update_limit_to_target_limits_to_high branch July 14, 2025 11:23
Bluefinger pushed a commit to Bluefinger/kibana that referenced this pull request Jul 22, 2025
# Summary
Hi Operations team! 👋

Recently I've worked on a
[few](elastic#227593)
[PRs](elastic#226052) that reduce our
page load bundle size, and while doing so I noticed that many of our
limits are much higher than the actual page load sizes. It made me
think: these limits should be realistic, because they’re one of the main
ways we protect page load performance.
Right now, based on the current limits, we theoretically allow up to
11,452,104 bytes (~11 MB) to load upfront. But when we check the real
page load, it’s only 5.192.979 bytes — about half of that.

We already have a `--update-limits` flag for the `node
scripts/build_kibana_platform_plugins.js --update-limits` command, but
it only bumps limits up when the size grows above the limit, adding a
flat 15 KB buffer to the bundle size.
I’d like to propose:
1. Allowing the `--update-limits` to allow folks to also lower limits
when the bundle shrinks drastically
2. Replacing the flat 15 KB buffer with 10% of the plugin’s size, so the
buffer scales realistically. Right now, with ~197 plugins,
`--update-limits` allows for an extra (15KB*197=) 3 MB above the total
page size — which is way too much in my opinion!

## What’s in this PR
✅ Adds logic to let us lower limits automatically, not just bump them up
with `node scripts/build_kibana_platform_plugins.js --update-limits`
✅ Replaces the flat +15 KB bump with a 10% buffer relative to each
plugin’s size when using `node scripts/build_kibana_platform_plugins.js
--update-limits`
✅ Updated the limits.yml with the result from the above script

## Why it matters
1. Keeps bundle sizes tight
2. Protects us from accidental regressions
kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
# Summary
Hi Operations team! 👋

Recently I've worked on a
[few](elastic#227593)
[PRs](elastic#226052) that reduce our
page load bundle size, and while doing so I noticed that many of our
limits are much higher than the actual page load sizes. It made me
think: these limits should be realistic, because they’re one of the main
ways we protect page load performance.
Right now, based on the current limits, we theoretically allow up to
11,452,104 bytes (~11 MB) to load upfront. But when we check the real
page load, it’s only 5.192.979 bytes — about half of that.

We already have a `--update-limits` flag for the `node
scripts/build_kibana_platform_plugins.js --update-limits` command, but
it only bumps limits up when the size grows above the limit, adding a
flat 15 KB buffer to the bundle size.
I’d like to propose:
1. Allowing the `--update-limits` to allow folks to also lower limits
when the bundle shrinks drastically
2. Replacing the flat 15 KB buffer with 10% of the plugin’s size, so the
buffer scales realistically. Right now, with ~197 plugins,
`--update-limits` allows for an extra (15KB*197=) 3 MB above the total
page size — which is way too much in my opinion!

## What’s in this PR
✅ Adds logic to let us lower limits automatically, not just bump them up
with `node scripts/build_kibana_platform_plugins.js --update-limits`
✅ Replaces the flat +15 KB bump with a 10% buffer relative to each
plugin’s size when using `node scripts/build_kibana_platform_plugins.js
--update-limits`
✅ Updated the limits.yml with the result from the above script

## Why it matters
1. Keeps bundle sizes tight
2. Protects us from accidental regressions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Operations Kibana-Operations Team v9.2.0

3 participants