pub enum BatchPolicy {
Fixed(usize),
Adaptive,
}Expand description
How aggressively the owner drains the remote-free queue.
Variants§
Fixed(usize)
Drain every N remote frees. v0.1 default = 64.
Adaptive
Stepped-threshold adaptive policy. The drain threshold steps
through 5 levels — [8, 16, 32, 64, 128] — based on observed
queue depth relative to queue_capacity:
- Queue length > 75% of capacity → step down (smaller batch, drain sooner) to relieve back-pressure on remote senders.
- Queue length < 25% of capacity → step up (larger batch, drain less often) to amortize the drain cost across more frees.
A cooldown of ADAPTIVE_COOLDOWN_TICKS maybe_drain calls
between adjustments prevents oscillation. Initial step is 3
(threshold = 64) — matches the Fixed(64) v0.1 default so an
Adaptive-policy owner behaves like a Fixed(64) owner until
the workload pushes the threshold off the middle level.
All arithmetic is integer-only; the 0.25 / 0.75 hysteresis band
is encoded as q*4 < cap / q*4 > cap*3. No floating point.
This is the v1.0 control law; the v2.0 EMA-based upgrade is gated on benchmark validation against this baseline.
Trait Implementations§
Source§impl Clone for BatchPolicy
impl Clone for BatchPolicy
Source§fn clone(&self) -> BatchPolicy
fn clone(&self) -> BatchPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more