Repository navigation
Make the pcap load memory budget configurable with --pcap-memory - #6
Merged
Merged
Conversation
Replaying a capture holds the whole file in memory, and two hardcoded caps bounded that: 1 GiB of loaded bytes and two million packets. Anyone with a big server and a bigger capture hit a wall with no knob to turn. The two caps are now one honest budget, raised with --pcap-memory: it counts frame bytes plus the 24-byte-per-record index, so it bounds actual memory and the separate packet cap falls out as redundant. Sizes parse in binary units (1G is 1<<30), deliberately unlike the decimal rate flags, because the old default was 1<<30 and a decimal 1G would have quietly shrunk it. The default stays 1 GiB. Record offsets widen to uint64 so budgets past 4 GiB actually work. Loading also got cheaper: the backing store is preallocated from the file size instead of doubling through append regrowth, and reads go through pcapgo's zero-copy path instead of allocating a buffer per packet. Peak RSS loading a 1.06 GiB capture drops from 2.19 GiB to 1.17 GiB, and a 5.3 GB capture loads in three seconds. The budget persists across runs like the rate limits do, and the wizard gets a matching field. related to issue #3
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.
Replaying a capture holds the whole file in memory, and two hardcoded caps bounded that: 1 GiB of loaded bytes and two million packets. Anyone with a big server and a bigger capture hit a wall with no knob to turn.
The two caps are now one honest budget, raised with --pcap-memory: it counts frame bytes plus the 24-byte-per-record index, so it bounds actual memory and the separate packet cap falls out as redundant. Sizes parse in binary units (1G is 1<<30), deliberately unlike the decimal rate flags, because the old default was 1<<30 and a decimal 1G would have quietly shrunk it. The default stays 1 GiB.
Record offsets widen to uint64 so budgets past 4 GiB actually work. Loading also got cheaper: the backing store is preallocated from the file size instead of doubling through append regrowth, and reads go through pcapgo's zero-copy path instead of allocating a buffer per packet. Peak RSS loading a 1.06 GiB capture drops from 2.19 GiB to 1.17 GiB, and a 5.3 GB capture loads in three seconds.
The budget persists across runs like the rate limits do, and the wizard gets a matching field.
related to issue #3