Skip to content

fix(router): adaptive tick evicts low-throughput legs, not just dead ones - #4201

Merged
0pcom merged 1 commit into
skycoin:developfrom
0pcom:fix/throughput-aware-eviction
Aug 26, 2026
Merged

fix(router): adaptive tick evicts low-throughput legs, not just dead ones#4201
0pcom merged 1 commit into
skycoin:developfrom
0pcom:fix/throughput-aware-eviction

Conversation

@0pcom

@0pcom 0pcom commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

The active-mux health gate only evicted legs passing zero traffic under load. A leg carrying a small fraction of what its peers do — a webrtc data channel beside stcpr legs — sailed through, yet it drags the no-skip reorder buffer just like a dead leg (the buffer head-of-line-stalls on its slow-arriving sequences).

Grade the stall gate by throughput: track a per-leg EWMA recv byte-rate; a leg below 0.25 × the active-set median rate, sustained over the health hysteresis, is a low-throughput outlier and is evicted (hot-swapped for a healthy standby, never leg 0). Zero traffic is the frac=0 special case, so this strictly widens the old gate.

Using the median (not max) makes it robust to the selector concentrating traffic on one leg — uniformly-underselected legs never false-trigger; only a genuine low outlier does.

bundle.wasm regenerated (TinyGo); parity_test (wazero) green. New tests cover the classifier and end-to-end eviction.

…ones

The active-mux health gate only evicted legs that passed ZERO traffic while the
group was loaded. A leg that carries a small FRACTION of what its peers do — a
webrtc data channel next to stcpr legs, say — sailed through, yet it drags the
no-skip reorder buffer exactly like a dead leg: the buffer head-of-line-stalls
waiting for that leg's slow-arriving sequences.

Grade the stall gate by throughput. Track a per-leg EWMA recv byte-rate; a leg
whose rate is below adaptThroughputOutlierFrac (0.25) of the active-set MEDIAN
rate, sustained over adaptHysteresis ticks, is a low-throughput outlier and is
evicted (hot-swapped for a healthy standby, never leg 0) like a stalled leg.
Zero traffic is the frac=0 special case, so this strictly widens the old gate.

Using the MEDIAN (not max) makes it robust to the selector concentrating traffic
on one leg: when most active legs carry a similar share and one carries <25% of
it, only that one is flagged; uniformly-underselected legs never false-trigger.

bundle.wasm regenerated (TinyGo); parity_test (wazero) green. New tests cover the
legLowThroughput classifier and end-to-end eviction of a sustained low-rate leg.
@0pcom
0pcom merged commit 1399dce into skycoin:develop Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant