pub enum LatencyDistribution {
Uniform {
start: Duration,
end: Duration,
},
Exponential {
min: Duration,
mean: Duration,
},
Bimodal {
fast_range: Range<Duration>,
slow_range: Range<Duration>,
slow_probability: f64,
},
}Expand description
A pluggable latency distribution for per-operation latency sampling.
Replaces plain uniform Range<Duration> sampling so simulations can exercise
the heavy P99 tail where timeout cascades, retry storms, and backpressure
collapse live. All variants sample deterministically through the simulation
RNG, so the same seed always yields the same sequence.
The default is Uniform, which samples identically to the
historical sample_duration (one RNG draw, no extra draws), keeping default
behavior unchanged.
§References
ExponentialmirrorsTigerBeetle’srandom_int_exponentialstorage/network delay (packet_simulator.zig).BimodalmirrorsFoundationDB’shalfLatencyfast/slow split (sim2.actor.cpp).
Variants§
Uniform
Uniform latency in [start, end). Equivalent to the historical
Range<Duration> sampling.
Exponential
Exponential latency with a minimum floor, modelling a long tail.
Samples min + mean * (-ln(u)) with u drawn uniformly from (0, 1],
giving a mean delay of roughly min + mean. Note this is the additive
form from the issue; TigerBeetle instead clamps with max(min, exp(mean)).
Fields
Bimodal
Bimodal latency: a fast cluster most of the time, a slow tail rarely.
With probability slow_probability the sample is drawn uniformly from
slow_range; otherwise from fast_range.
Implementations§
Trait Implementations§
Source§impl Clone for LatencyDistribution
impl Clone for LatencyDistribution
Source§fn clone(&self) -> LatencyDistribution
fn clone(&self) -> LatencyDistribution
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LatencyDistribution
impl Debug for LatencyDistribution
Source§impl Default for LatencyDistribution
impl Default for LatencyDistribution
Source§impl PartialEq for LatencyDistribution
impl PartialEq for LatencyDistribution
Source§fn eq(&self, other: &LatencyDistribution) -> bool
fn eq(&self, other: &LatencyDistribution) -> bool
self and other values to be equal, and is used by ==.