feat(routing-policy): size the adaptive forward mux on upload (bidirectional sizing) - #4138
Merged
Merged
Conversation
…ctional sizing) The adaptive preset's on_tick controller sized only the reverse (download) direction: it read RecvBytes deltas and widened/collapsed the mux under sustained download load, while the forward (upload) width was pinned at one leg. SentBytes was never read, so an upload-heavy flow could not grow the send mux. Add a forward controller that mirrors the reverse one, driven by SentBytes: the same EWMA smoothing, peak decay, saturated/idle thresholds, hysteresis and cooldown constants (reused, not duplicated). On sustained upload saturation it emits a new RotationAction.AddForwardLeg that the router actuates forward-only (appendRouteAsymmetric addFwd=true/addRev=false, via addOneAuxSendLeg), so the extra send capacity does not enlarge the reverse/download set; it collapses back to the lean single forward leg when the upload goes idle. A combined desiredActive target folds the forward growth in so the reverse park/drop-recovery rules never tear down a forward-grown leg. When SentBytes is flat the whole forward machine stays dormant, so a download-only or idle flow evolves byte-identically to before. Rebuilt the preset wasm bundle so native and wazero make identical decisions; extended the parity harness with an upload sequence and added engine tests for upload-widen / download-regression / idle-collapse.
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.
The adaptive preset's on_tick controller sized only the reverse (download) direction: it read
RecvBytesdeltas and widened/collapsed the mux under sustained download load, while the forward (upload) width stayed pinned at one leg.SentByteswas never read, so an upload-heavy flow could not grow its send mux.This adds a forward controller that mirrors the reverse one, driven by
SentBytes, reusing (not duplicating) the same EWMA smoothing, peak decay, saturated/idle thresholds, hysteresis and cooldown constants. On sustained upload saturation it emits a newRotationAction.AddForwardLeg; the router actuates it forward-only (appendRouteAsymmetric(addFwd=true, addRev=false)via a newaddOneAuxSendLeg), so the extra send capacity does not enlarge the reverse/download set. It collapses back to the lean single forward leg when the upload goes idle. A combineddesiredActivetarget folds the forward growth into the convergence target so the reverse park / drop-recovery rules never tear down a forward-grown leg.When
SentBytesis flat the whole forward machine stays dormant, so download-only and idle flows evolve byte-identically to before — the validated steady shape (fwd=1, rev=1 active + 2 standby) is unchanged.Native/wazero parity: the preset wasm bundle was rebuilt with TinyGo so the native and wazero engines make identical decisions; the parity harness gained an upload sequence (
AddForwardLegverified to fire and round-trip the wire), andgo test ./pkg/router/policy/...passes. New engine tests cover upload-widen, download-regression (unchanged), and idle-collapse.Caveat surfaced in the report: the warm-standby pool is full-duplex, so a forward-only widen must dial a fresh send leg rather than promote a spare; and a send-only leg would black-hole any download the far end mis-spreads onto it — acceptable for an upload-dominant flow and pruned by the existing leg-dataprogress/liveness guards.