perf(exporter): retain pre-compressed deflate payloads in memory - #6059
Merged
another-rex merged 2 commits intoSep 24, 2026
Merged
another-rex merged 2 commits into
another-rex merged 2 commits into
Conversation
Stage pre-compressed deflate payloads in memory on vulnMeta instead of writing 2M+ small files to local scratch disk. Eliminates ext4 directory inode lock contention and 4M+ file syscalls during ZIP creation. Also updates -cleanup-scratch-dir to default to true.
michaelkedar
previously approved these changes
Sep 23, 2026
Comment on lines
+83
to
+82
| compressedBytes := compBuf.Bytes() | ||
| compressedBytes := bytes.Clone(compBuf.Bytes()) |
Member
There was a problem hiding this comment.
Is the clone here actually necessary?
Contributor
Author
There was a problem hiding this comment.
Not really, I guess it resizes the buffer down to the right size so we don't have the extra room taken up. But probably not a big deal.
compBuf is scoped to each loop iteration and never mutated. Using compBuf.Bytes() directly avoids 2M heap allocations and memmoves during download.
michaelkedar
approved these changes
Sep 23, 2026
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.
I give up on saving memory by writing to disk.
Previously, the exporter staged ~2M pre-compressed
.deflatefiles to the local scratch disk in Phase 1, then re-opened and streamed them into ZIP archives during Phase 2. On ext4 filesystems with millions of entries in a single directory, this caused a lot of stall time and contention. (up to 87.6% stall time in test), causing the exporter to overrun the 15 minutes.The guess for why this is only happening in test currently is because of how long the node has been live for, keeping all those files on disk, increasing the disk pressure.
Because all 2M compressed payloads only consume ~8.5 GiB in total (well within the 50 GiB
GOMEMLIMITand 60 GiB memory limit), we now retain the pre-compressed bytes directly in memory onvulnMeta.Also changes
-cleanup-scratch-dirdefault totruenow that the scratch directory only holds ~47 temporary.zipfiles (<1ms deletion).agy