Skip to content

Adaptive SQM: rate-proportional HTB burst (~1 ms of line time) instead of the 5 KB clamp#1009

Open
Optic00 wants to merge 1 commit into
Ozark-Connect:mainfrom
Optic00:feature/sqm-burst-scaling
Open

Adaptive SQM: rate-proportional HTB burst (~1 ms of line time) instead of the 5 KB clamp#1009
Optic00 wants to merge 1 commit into
Ozark-Connect:mainfrom
Optic00:feature/sqm-burst-scaling

Conversation

@Optic00

@Optic00 Optic00 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #1006.

calc_burst() now scales burst/cburst with the shaped rate - rate_mbps * 125 bytes (~1 ms of line time), clamped to [1500, 131072] - instead of clamping at 5000 bytes. The function is shared between directions, so egress gets the same fix.

Why: with a burst of 1-3 packets, HTB can only release a few packets per timer/softirq wakeup; on ingress IFB paths without GRO (observed maxpacket 1492 on UCG Fiber) throughput then degenerates into a function of scheduling latency instead of the configured rate. The full measurement matrix, the latency validation across rate tiers, and the end-to-end validation with exactly this formula are in #1006 - short version: 533/452 -> 832/521 Mbit at a 900/550 config on a UCG Fiber, flat p99 RTTs, 0% loss.

Changes:

  • ScriptGenerator.cs: new calc_burst formula; the comment now documents the measured reasoning and explicitly does not claim to contradict your earlier 5KB/8KB queue-variance findings from other hardware (they were not re-measured here).
  • ScriptGeneratorTests.cs: a test asserting the formula and both clamps in every generated script, including that every embedded copy of calc_burst (boot + speedtest + ping scripts) carries the new formula, not just one of them.

Behavior at low rates is effectively unchanged: below ~40 Mbit the formula stays within the previous 1500-5000b range (the 1500b floor applies below 12 Mbit; 100 Mbit yields 12.5k, i.e. still ~1 ms).

As offered in #1006: if you'd rather have the ceiling per-platform or as an advanced-config value instead of a constant, happy to rework in that direction. And if you can re-run your queue-depth-variance test with the rate-proportional burst on the hardware the 5 KB result came from, that would settle whether the higher clamp is safe everywhere.

Tests: NetworkOptimizer.Sqm.Tests 257/257 green on the rebased branch; the full suite was green on the pre-rebase commit.

calc_burst() now scales burst/cburst with ~1 ms of line time
(rate_mbps * 125 bytes, clamped to [1500, 131072]) instead of
clamping at 5000 bytes. On ingress IFB paths without GRO the 5 KB
clamp keeps HTB timer-bound: measured on UCG Fiber at a 900 Mbit
cap, throughput rises from ~630 to ~820-830 Mbit with flat RTTs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant