Expand description
Pluggable congestion control for the RCP tool family.
This crate exposes a Controller trait that encapsulates a
congestion-control algorithm — consuming operation-completion
Samples and emitting concurrency / rate Decisions. The trait is
intentionally small and synchronous so algorithms can be implemented and
tested without any I/O, async runtime, or wall-clock dependence.
Three concentric layers are envisioned for integration with the rcp / rrm / rlink / filegen tools:
- Algorithm — the
Controllertrait and its implementations; pure. - Control loop — plumbing that collects samples from the hot path,
drives the controller on a fixed tick, and publishes decisions. Lives
outside this crate (in
throttleor a thin adapter) and is not part of Phase 1. - Enforcement — the existing
throttletoken buckets and semaphores, with their limits driven by the control loop.
§Built-in controllers
NoopController— never limits. Default when congestion control is disabled.FixedController— honors a static concurrency/rate budget. Mirrors the existing manual--ops-throttle/--iops-throttleknobs and is the regression baseline for adaptive algorithms.RatioController— adaptive controller that tracks queueing-delay inflation by comparing two windowed latency percentiles (current vs baseline) and adjusts the concurrency cap to stay at the onset of inflation. Inspired by TCP Vegas.
Additional adaptive variants (for example BBR-style) can be layered on the same trait without changes to the enforcement or control-loop layers.
§Testing
The sim module provides a deterministic single-bottleneck simulator
that drives any Controller through a configured scenario and returns a
trace of samples and decisions. See the module docs for the model.
Modules§
- format
- Binary log file format for auto-meta recordings.
- sim
- Deterministic, event-driven simulator for evaluating
Controllers. - testing
- Test utilities for asserting on emitted samples.
Structs§
- Control
Unit - A single resource’s control task.
- Controller
Snapshot - Read-only view of a controller’s internal state, intended for the progress bar and other observability surfaces.
- Decision
- Absolute limits emitted by a controller for the enforcement layer to apply.
- Fixed
Controller - Controller that always emits the same configured
Decision. - Histogram
Accumulator - Per-controller HDR latency accumulator.
- Noop
Controller - Controller that always emits
Decision::UNLIMITED. - Probe
- A measurement-in-progress for a single operation.
- Ratio
Config - Tunable parameters for
RatioController. - Ratio
Controller - Adaptive controller driven by a two-window latency-percentile ratio.
- Routing
Sink - A
SampleSinkthat fans samples out to per-resource bounded MPSC channels, typically each drained by oneControlUnit. - Routing
Sink Builder - Incrementally opt resources into the routing sink. Each
*_receivercall registers a channel for the correspondingResourceKindand returns the receiver the caller must hand to aControlUnit. - Sample
- A single observation of an operation’s behavior, fed to a
Controller.
Enums§
- Metadata
Op - Which metadata syscall is being measured.
- Outcome
- The outcome of a single measured operation.
- Resource
Kind - Which resource a probe is measuring.
- Side
- Which side of an operation a probe is on.
Constants§
- DEFAULT_
TICK_ INTERVAL - Default cadence at which a control unit calls
on_tick. - HDR_
HIGHEST_ TRACKABLE_ MICROS - Maximum value representable in the histogram, in microseconds (1 hour).
- HDR_
LOWEST_ DISCERNIBLE_ MICROS - Minimum value representable in the histogram, in microseconds.
- HDR_
SIGNIFICANT_ FIGURES - Significant figures of precision tracked by the histogram.
- N_
META_ OPS - Number of
MetadataOpvariants. Keep in sync when adding variants. - N_
META_ RESOURCES - Number of distinct (Side, MetadataOp) controllers.
- N_SIDES
- Number of
Sidevariants.
Traits§
- Controller
- A pluggable congestion-control algorithm.
- Sample
Sink - Consumer of completed operation samples.
Functions§
- clear_
sample_ sink - Remove the current sink, if any. After this call, probes are no-ops again.
- install_
sample_ sink - Install the process-wide
SampleSink. Replaces any prior sink.