Skip to content

Fix reliable latency under bursty loss and RTT swings - #13

Merged
stasadance merged 1 commit into
mainfrom
claude/project-thread-3ut2e9
Nov 24, 2026
Merged

stasadance merged 1 commit into
mainfrom
claude/project-thread-3ut2e9

Conversation

@stasadance

@stasadance stasadance commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Fixes the two weak spots from the bench scenarios.

Root cause

In both scenarios, SCTP's cwnd collapses after a loss (15 KB → 5 KB). The gate only capped total outstanding at 64 KiB, so unreliable kept getting admitted. It then sat unsent in SCTP's queue ahead of reliable, and reliable waited behind it.

Changes

  • Gate: unreliable is dropped while SCTP holds more than 2400 B it can't send yet (cwnd full). Only applies when unreliableLimit is on.
  • Pacer, RTT swings: if two drain samples don't bring srtt down, the RTT rise came from the path, not from our queue. The pacer takes srtt as the new base instead of draining to the floor. Sim with RTT swinging 200-600 ms: 59 KB/s, was 15 KB/s.
  • Pacer: delivery samples are capped at 500 ms. Before, a queue growing faster than wall time kept the controller from ever running (found by the new bufferbloat sim).

Bench (1 seed × 20 s each, Chrome, vs 04-scenarios)

scenario ping p95 reliable p95 unreliable age p95 unreliable KB/s
bursty 264 → 275 749 → 229 (ndc 303) 226 → 184 21.1 → 22.1
rtt-swing 1083 → 789 1749 → 1402 955 → 423 7.2 → 2.5
random5 341 → 256 821 → 463 293 → 237 13.3 → 11
bloat 440 → 386 800 → 381 394 → 319 9.3 → 8.5
rtt400 607 → 566 1299 → 667 566 → 440 6.2 → 3.1
clean 204 102 102 27.2

Tradeoff: on cwnd-limited links (high RTT plus loss), less unreliable gets through, but what does arrive is fresh. The remaining limit at 400-600 ms RTT is SCTP's loss-based congestion control: about 24 KB/s at 600 ms with 1% loss. Fixing that is a congestion control change in the rtc fork, not part of this PR.

Tests

Rust: 12 pass, including new bufferbloat and RTT-swing sims. e2e: all pass.

…h changes

- Unreliable sends are dropped while SCTP holds more than 2400 B it can't
  send (cwnd full). After loss collapses cwnd, unreliable used to pile up
  unsent ahead of reliable, which then waited behind it.
- Pacer: if two drain samples don't bring srtt down, the RTT rise is the
  path, not our queue: take srtt as the new base instead of draining to
  the floor. Delivery samples are capped at 500 ms so a fast-growing queue
  can't keep the controller from running.
- Sims for network-side bufferbloat and a 200-600 ms RTT swing.
@stasadance
stasadance merged commit d381eec into main Nov 24, 2026
4 checks passed
@stasadance
stasadance deleted the claude/project-thread-3ut2e9 branch November 24, 2026 04:17
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