Refactor xtask util helpers into modular modules#2095
Merged
Conversation
1 task
oferchen
added a commit
that referenced
this pull request
May 7, 2026
Specifies a PID-style controller that resizes per-pipeline I/O buffer windows in response to throughput feedback, layered on top of the existing pressure-driven BufferPool grow/shrink logic. Covers setpoint/PV/MV signals, sample cadence, anti-windup clamp, integration points (disk-commit channel capacity, buffer pool slot size, multiplex frame batching), Ziegler-Nichols tuning strategy, and three workload presets gated behind --adaptive-buffers. Maps to follow-up tasks #2095 (implementation) and #2096 (convergence tests).
oferchen
added a commit
that referenced
this pull request
May 7, 2026
Specifies a PID-style controller that resizes per-pipeline I/O buffer windows in response to throughput feedback, layered on top of the existing pressure-driven BufferPool grow/shrink logic. Covers setpoint/PV/MV signals, sample cadence, anti-windup clamp, integration points (disk-commit channel capacity, buffer pool slot size, multiplex frame batching), Ziegler-Nichols tuning strategy, and three workload presets gated behind --adaptive-buffers. Maps to follow-up tasks #2095 (implementation) and #2096 (convergence tests).
3 tasks
oferchen
added a commit
that referenced
this pull request
May 7, 2026
Add a PID-style controller that adapts per-pipeline buffer window size in response to observed throughput, per the design RFC at docs/design/adaptive-buffer-controller.md. The new module exposes AdaptiveBufferController and a builder-style ControllerConfig with Ziegler-Nichols LAN-preset gains as defaults (K_p=0.6, K_i=0.2, K_d=0.05). Internally a single std::sync::Mutex guards the integrator, previous-error sample, and previous-sample timestamp; the recommended buffer size is exposed via an AtomicUsize for lock-free reads from the hot path. The dt is clamped to [1ms, 5s] to defend against divide-by-zero on the derivative term and integral windup on a stalled producer; the integrator is independently clamped by the configured anti-windup window. Tests cover proportional growth/shrink, integral steady-state-error elimination, derivative damping on a step input, anti-windup clamping under sustained error, both buffer-size clamps, reset semantics, zero-dt safety, and a synthetic-plant convergence test against a linear-saturating throughput model that confirms the default gains settle within 10% of the setpoint inside 50 samples. Integration into write-batch sizing, BufferPool capacity hints, and multiplex frame batching is intentionally out of scope; that work is tracked by the wiring follow-up under task #2096. The RFC originally proposed crates/engine/src/pipeline/buffer_controller.rs, but the engine crate has no pipeline module today; placing the file alongside throughput.rs keeps the module tree flat and groups it with the existing throughput EMA it will eventually consume. The deviation is documented in the file's top doc comment.
oferchen
added a commit
that referenced
this pull request
May 7, 2026
Add a PID-style controller that adapts per-pipeline buffer window size in response to observed throughput, per the design RFC at docs/design/adaptive-buffer-controller.md. The new module exposes AdaptiveBufferController and a builder-style ControllerConfig with Ziegler-Nichols LAN-preset gains as defaults (K_p=0.6, K_i=0.2, K_d=0.05). Internally a single std::sync::Mutex guards the integrator, previous-error sample, and previous-sample timestamp; the recommended buffer size is exposed via an AtomicUsize for lock-free reads from the hot path. The dt is clamped to [1ms, 5s] to defend against divide-by-zero on the derivative term and integral windup on a stalled producer; the integrator is independently clamped by the configured anti-windup window. Tests cover proportional growth/shrink, integral steady-state-error elimination, derivative damping on a step input, anti-windup clamping under sustained error, both buffer-size clamps, reset semantics, zero-dt safety, and a synthetic-plant convergence test against a linear-saturating throughput model that confirms the default gains settle within 10% of the setpoint inside 50 samples. Integration into write-batch sizing, BufferPool capacity hints, and multiplex frame batching is intentionally out of scope; that work is tracked by the wiring follow-up under task #2096. The RFC originally proposed crates/engine/src/pipeline/buffer_controller.rs, but the engine crate has no pipeline module today; placing the file alongside throughput.rs keeps the module tree flat and groups it with the existing throughput EMA it will eventually consume. The deviation is documented in the file's top doc comment.
oferchen
added a commit
that referenced
this pull request
May 7, 2026
Add a PID-style controller that adapts per-pipeline buffer window size in response to observed throughput, per the design RFC at docs/design/adaptive-buffer-controller.md. The new module exposes AdaptiveBufferController and a builder-style ControllerConfig with Ziegler-Nichols LAN-preset gains as defaults (K_p=0.6, K_i=0.2, K_d=0.05). Internally a single std::sync::Mutex guards the integrator, previous-error sample, and previous-sample timestamp; the recommended buffer size is exposed via an AtomicUsize for lock-free reads from the hot path. The dt is clamped to [1ms, 5s] to defend against divide-by-zero on the derivative term and integral windup on a stalled producer; the integrator is independently clamped by the configured anti-windup window. Tests cover proportional growth/shrink, integral steady-state-error elimination, derivative damping on a step input, anti-windup clamping under sustained error, both buffer-size clamps, reset semantics, zero-dt safety, and a synthetic-plant convergence test against a linear-saturating throughput model that confirms the default gains settle within 10% of the setpoint inside 50 samples. Integration into write-batch sizing, BufferPool capacity hints, and multiplex frame batching is intentionally out of scope; that work is tracked by the wiring follow-up under task #2096. The RFC originally proposed crates/engine/src/pipeline/buffer_controller.rs, but the engine crate has no pipeline module today; placing the file alongside throughput.rs keeps the module tree flat and groups it with the existing throughput EMA it will eventually consume. The deviation is documented in the file's top doc comment.
This was referenced May 14, 2026
oferchen
added a commit
that referenced
this pull request
May 18, 2026
Specifies a PID-style controller that resizes per-pipeline I/O buffer windows in response to throughput feedback, layered on top of the existing pressure-driven BufferPool grow/shrink logic. Covers setpoint/PV/MV signals, sample cadence, anti-windup clamp, integration points (disk-commit channel capacity, buffer pool slot size, multiplex frame batching), Ziegler-Nichols tuning strategy, and three workload presets gated behind --adaptive-buffers. Maps to follow-up tasks #2095 (implementation) and #2096 (convergence tests).
oferchen
added a commit
that referenced
this pull request
May 18, 2026
Add a PID-style controller that adapts per-pipeline buffer window size in response to observed throughput, per the design RFC at docs/design/adaptive-buffer-controller.md. The new module exposes AdaptiveBufferController and a builder-style ControllerConfig with Ziegler-Nichols LAN-preset gains as defaults (K_p=0.6, K_i=0.2, K_d=0.05). Internally a single std::sync::Mutex guards the integrator, previous-error sample, and previous-sample timestamp; the recommended buffer size is exposed via an AtomicUsize for lock-free reads from the hot path. The dt is clamped to [1ms, 5s] to defend against divide-by-zero on the derivative term and integral windup on a stalled producer; the integrator is independently clamped by the configured anti-windup window. Tests cover proportional growth/shrink, integral steady-state-error elimination, derivative damping on a step input, anti-windup clamping under sustained error, both buffer-size clamps, reset semantics, zero-dt safety, and a synthetic-plant convergence test against a linear-saturating throughput model that confirms the default gains settle within 10% of the setpoint inside 50 samples. Integration into write-batch sizing, BufferPool capacity hints, and multiplex frame batching is intentionally out of scope; that work is tracked by the wiring follow-up under task #2096. The RFC originally proposed crates/engine/src/pipeline/buffer_controller.rs, but the engine crate has no pipeline module today; placing the file alongside throughput.rs keeps the module tree flat and groups it with the existing throughput EMA it will eventually consume. The deviation is documented in the file's top doc comment.
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
Testing
Codex Task