perf(engine): BufferPool byte-budget cap to bound memory under large buffers#4102
Closed
oferchen wants to merge 4 commits into
Closed
perf(engine): BufferPool byte-budget cap to bound memory under large buffers#4102oferchen wants to merge 4 commits into
oferchen wants to merge 4 commits into
Conversation
…buffers Adds an optional `pooled_bytes_budget` field to `BufferPool` that caps the total `capacity()` of buffers retained in the central queue. The hybrid cap with the existing count-based soft capacity defends against a handful of very-large adaptive buffers blowing through the memory ceiling. Threaded through `GlobalBufferPoolConfig::pooled_bytes_budget` so callers opt in via the existing builder; default `None` preserves count-only behavior with no regression for existing callers. Refs #2245
Owner
Author
|
Tests reveal an accounting bug in the agent's pooled_bytes tracking (test pooled_bytes_tracks_admission_and_pop expects 0 but gets 1). Multiple test failures across platforms after the first fmt round. Closing for rework; task #2245 reopened. |
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.
Summary
pooled_bytes_budgetfield toBufferPoolthat caps the totalcapacity()of buffers retained in the central queue.ADAPTIVE_BUFFER_HUGE) blowing through the count-only ceiling.GlobalBufferPoolConfig::pooled_bytes_budget; defaultNonepreserves the historical count-only behavior so existing callers see no change.pooled_bytescounter updated on every admit and pop; relaxed ordering keeps the overhead at one extra add/sub per central-queue operation.Refs #2245.
Test plan
pooled_bytes_budget_drops_oversized_buffers: 1 MB buffers + 16 KB budget; central queue stays empty and pooled bytes stay within budget.pooled_bytes_budget_high_retains_normally: generous budget; count cap fires first and pool fills its slots.count_cap_still_enforced_without_byte_budget: regression test for existing count-only path.pooled_bytes_tracks_admission_and_pop: pooled-byte counter increments on admit and decrements on pop.pooled_bytes_budget_rejects_zero:with_pooled_bytes_budget(0)panics.pooled_bytes_budget_zero_is_treated_as_unboundedinglobal.rs: filter logic mirrorsmemory_cap=Some(0).