fix(router): swap out a sustained-bad primary leg instead of riding it forever - #4208
Merged
Merged
Conversation
…t forever Every park/evict rule exempts leg 0 — the group must always keep a selectable send leg — so when the PRIMARY itself is the drag (a webrtc-second-hop leg anchoring a download at 2x the latency and a fraction of the throughput of its peers, e.g. observed live: leg 0 = 546ms/30-rtx carrying 256K while leg 1 = 311ms/15-rtx carried 917K), no metric could act on it and it bottlenecked every transfer it anchored. Add rule (2.5): when leg 0 is a gross latency/throughput outlier for adaptHysteresis ticks AND a healthy active alternative exists, DROP leg 0. leg 0 can't be parked to standby (setLegStandby refuses idx 0), but dropping it makes dropLegsByIndex flush its in-flight window onto a healthy leg, then removeLegs compacts and promotes the next aux into the primary slot, and self-heal (fired by the drop) re-dials a replacement into the reserve — a hot-swap of the primary with the retx buffer rescued. Guarded by the healthy-alternative requirement + its own hysteresis streak so a good or transiently-spiking primary is never swapped; if the promoted aux is itself bad the next tick swaps again, each swap shedding a drag until a healthy leg anchors the group. bundle.wasm regenerated (TinyGo); parity_test green; new test covers both the bad-primary swap and the no-swap-on-healthy-primary guard.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every park/evict rule exempts leg 0 (the group must always keep a send leg), so when the primary itself is the drag — a webrtc-second-hop leg anchoring a download at ~2x the latency and a fraction of the throughput of its peers (observed live: leg 0 = 546ms/30-rtx carrying 256K while leg 1 = 311ms/15-rtx carried 917K) — no metric could act on it.
Rule (2.5): when leg 0 is a gross latency/throughput outlier for the health hysteresis and a healthy active alternative exists, DROP leg 0. It can't be parked (setLegStandby refuses idx 0), but dropping it makes
dropLegsByIndexflush its in-flight window onto a healthy leg,removeLegspromote the next aux into the primary slot, and self-heal re-dial a replacement — a hot-swap of the primary with the retx buffer rescued. Guarded so a healthy or transiently-spiking primary is never swapped.bundle.wasmregenerated;parity_testgreen; test covers the swap + the no-swap-on-healthy guard.