perf: reduce busybox init-time memory allocation#19952
Draft
perf: reduce busybox init-time memory allocation#19952
Conversation
Reduce init-time memory for the busybox binary by eliminating unnecessary imports, deferring allocations with sync.OnceValue, and breaking heavy transitive dependency chains. Results (Linux amd64): - Busybox: 16.1 MB -> 12.9 MB heap (-20%), 245K -> 173K mallocs (-29%) - AC standalone: 9.1 MB -> 7.2 MB heap (-21%), 87K -> 51K mallocs (-41%) - Binary size: 205 MB -> 194 MB (-5%) Generated with assistance from AI Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Skipping CI for Draft Pull Request. |
Contributor
🚀 Build Images ReadyImages are ready for commit a5e5e0e. To use with deploy scripts: export MAIN_IMAGE_TAG=4.11.x-629-ga5e5e0eabe |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Test files with sql_integration build tag reference schema vars that are now sync.OnceValue functions. Add () to all schema.XxxSchema and pkgSchema.XxxSchema references in test files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Each zap logger created with sampling enabled allocates a counters [7][4096]counter array (~450 KB). With 100+ loggers across sensor's dependency tree, this totals ~46 MB of heap (40% of sensor's runtime memory at 128Mi limit). Remove per-logger sampling from the zap config. This trades potential log volume increase for massive memory savings. On an idle cluster, sensor's heap drops from ~115 MB to ~69 MB. For edge deployments with tight memory limits, this is critical — it enables sensor to run at ~50 Mi instead of ~82 Mi. Generated with assistance from AI Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Reduce init-time memory for the busybox binary and all components by eliminating unnecessary imports, deferring allocations with sync.OnceValue, and breaking heavy transitive dependency chains.
Results (Linux amd64):
User-facing documentation
Testing and quality
Automated testing
How I validated my change
Heap profiling with pprof in Linux amd64 containers via podman.
🤖 Generated with Claude Code