Skip to content

perf: reduce busybox init-time memory allocation#19952

Draft
davdhacs wants to merge 4 commits intomasterfrom
davdhacs/busybox-init-memory-reduction
Draft

perf: reduce busybox init-time memory allocation#19952
davdhacs wants to merge 4 commits intomasterfrom
davdhacs/busybox-init-memory-reduction

Conversation

@davdhacs
Copy link
Copy Markdown
Contributor

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):

  • 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%)

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • modified existing tests

How I validated my change

Heap profiling with pprof in Linux amd64 containers via podman.

🤖 Generated with Claude Code

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>
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 11, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Sorry @github-actions[bot], your pull request is larger than the review limit of 150000 diff characters

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 11, 2026

🚀 Build Images Ready

Images are ready for commit a5e5e0e. To use with deploy scripts:

export MAIN_IMAGE_TAG=4.11.x-629-ga5e5e0eabe

davdhacs and others added 3 commits April 11, 2026 11:03
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant