Skip to main content

REFILL_PACING_SECS

Constant REFILL_PACING_SECS 

Source
pub const REFILL_PACING_SECS: u64 = 5;
Expand description

How long the refill that follows a wipe of the counterparty’s stock is paced for, at a rate of one fifth of the target per second (at least one keep-alive’s worth, never above max_surbs_per_sec; see pacing_cap), so the refill takes about as many seconds.

After a wipe the level is zero against the target, and left alone the PID commands its output limit (max_surbs_per_sec; the prototype hit 4975 per second against a ceiling of 5000 per second in the integration cluster) until the level is back. On a path through two or three relayers on one machine that burst congests the relays themselves, the replies it is meant to restore arrive late, and late replies are what the verdicts are made of. The organic gate is open for the whole refill anyway, so spreading it over a few seconds costs little: the SURBs of the next data packets arrive in the meantime.

The start of a session at the Entry is the same state: the counterparty holds nothing, the level estimate says so, and the PID would command its ceiling from the first tick. That flood lost replies at session start (one flush tick about three seconds in: 1037 expected, 201 observed), the corroborated verdict judged the two slowest relayers dead on those, and wiped the fresh stock; hoprnet#8484’s cold burst was the same flood seen from the data path. The Entry arms the same pacing when its balancer starts (BalancerStateValues::arm_refill_pacing), and the fill reaches the target in about five seconds instead of one and a half, sparing the relays.

While the window lasts the PID does not run: the balancer commands the cap while the level is below the target and nothing from the moment it is reached. A cap applied to the PID’s output instead would let it integrate the full error for the whole window and answer a level at or past the target with its ceiling when the window ends. The controller is rebuilt with its own gains and bounds when the window ends, so that it starts from the current error. Neither max_surbs_per_sec nor the bounds SurbBalancer::start_control_loop rebuilds the PID from change.