pub struct ConcurrencyRamp { /* private fields */ }Expand description
Drives concurrency upward on a live transfer while it pays to do so.
Implementations§
Source§impl ConcurrencyRamp
impl ConcurrencyRamp
Sourcepub fn starting_at(min_gain_frac: f64, start: usize, max: usize) -> Self
pub fn starting_at(min_gain_frac: f64, start: usize, max: usize) -> Self
min_gain_frac is the marginal goodput, as a fraction of the
single-connection rate, that a new connection must add to be kept.
Start the search at start connections rather than at one.
§Why the search no longer climbs from one
Climbing costs a measurement window per level, and a window long enough to
outlast slow start (see WINDOW_DELTAS) is long enough that the climb dominates
a short transfer. Climbing from one is only worth it if the levels above one are
likely to be much better — and on the paths measured, they are not.
The asymmetry, not a claimed win, is what justifies starting low. Measured
over 20 paired repetitions on four objects, starting at 1 connection is
statistically indistinguishable from a fixed baseline while fixed -x 8
cost 1.37–3.04x, and on a path a single stream already saturates -x 8
incurred a 3.6x slowdown where -x 1 was 1.17x. So the downside of starting
high is large and measured; the upside is not.
Starting at one is therefore a conservative policy choice, ensuring minimal overhead while admitting more connections only when headroom is proven.
pub fn new(min_gain_frac: f64, max: usize) -> Self
Sourcepub fn start(&mut self, now: f64, delta: f64)
pub fn start(&mut self, now: f64, delta: f64)
Begin the first window. now is the transfer’s clock, delta the measured
per-request setup cost.
Sourcepub fn observe(&mut self, bytes: u64, now: f64)
pub fn observe(&mut self, bytes: u64, now: f64)
Record bytes delivered by the whole transfer.
Aggregate, not per-connection: the question is whether the path is carrying more, and a per-connection view cannot answer it — on a saturated link each connection’s own rate falls as connections are added while the total stays flat, which is exactly the case the ramp must detect.
Trait Implementations§
Source§impl Clone for ConcurrencyRamp
impl Clone for ConcurrencyRamp
Source§fn clone(&self) -> ConcurrencyRamp
fn clone(&self) -> ConcurrencyRamp
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more