Skip to content

test: AIMD limiter convergence under error injection (#2092) - #4007

Merged
oferchen merged 2 commits into
masterfrom
test/aimd-limiter-convergence-2092
May 14, 2026
Merged

oferchen merged 2 commits into
masterfrom
test/aimd-limiter-convergence-2092

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Adds focused convergence tests covering the bandwidth limiter under an Additive-Increase/Multiplicative-Decrease control loop with simulated error injection.
  • Six new tests in crates/bandwidth/src/limiter/tests/aimd_convergence.rs:
    • Steady-state convergence with no errors (rate oscillates near target across six measurement windows).
    • Multiplicative-decrease on a single simulated error (rate halves and converges to the new target).
    • Repeated errors drive the rate down geometrically; each successive measurement is roughly half of the prior.
    • Additive-increase recovery after the error stream ends (monotonically rising observed rate).
    • Decrease-then-recover round-trip returns to the initial baseline within 5%.
    • Stability under an intermittent error pattern (no runaway oscillation; rate stays inside the floor/ceiling reach).
    • Edge case: repeated halving clamps at the configured floor, and the absolute floor of 1 B/s never underflows.

Implementation notes

  • The limiter's algorithm is a token-bucket pacer; AIMD is the controller pattern that callers (and these tests) layer on top via update_limit.
  • All sleeps go through the test-support recording path; assertions use LimiterSleep::requested() so the tests are deterministic and free of wall-clock jitter.
  • Each measurement runs a two-chunk warm-up so the first-call boundary (no last_instant yet) does not skew the observation.
  • No production code changes; the existing public API is sufficient to drive the AIMD trajectory and validate convergence at every stage.

Test plan

  • CI: fmt + clippy
  • CI: nextest (Linux/macOS/Windows/musl)

Drives the token-bucket bandwidth limiter through an
Additive-Increase/Multiplicative-Decrease control loop and verifies the
observed throughput tracks the configured rate at every stage: steady
state under no errors, multiplicative decrease on simulated error,
recovery via additive increase, stability under intermittent errors, and
clamping at the minimum rate floor.

All assertions use the deterministic recorded sleep durations from the
test-support infrastructure to remain free of wall-clock flakiness.
@github-actions github-actions Bot added the test label May 13, 2026
@oferchen
oferchen merged commit 9dbbe8c into master May 14, 2026
39 checks passed
@oferchen
oferchen deleted the test/aimd-limiter-convergence-2092 branch May 14, 2026 14:58
oferchen added a commit that referenced this pull request May 18, 2026
* test: add AIMD convergence tests under error injection (#2092)

Drives the token-bucket bandwidth limiter through an
Additive-Increase/Multiplicative-Decrease control loop and verifies the
observed throughput tracks the configured rate at every stage: steady
state under no errors, multiplicative decrease on simulated error,
recovery via additive increase, stability under intermittent errors, and
clamping at the minimum rate floor.

All assertions use the deterministic recorded sleep durations from the
test-support infrastructure to remain free of wall-clock flakiness.

* style: apply cargo fmt to aimd convergence tests
oferchen added a commit that referenced this pull request Jun 10, 2026
Adds a fourth IoUringPolicy variant (SqpollOff) wired to the new --no-io-uring-sqpoll flag. The variant keeps io_uring active for file and socket I/O but suppresses IORING_SETUP_SQPOLL via a process-wide gate that build_ring() and the session-pool ring builder consult. This gives operators a deterministic opt-out for rootless containers and Kubernetes pods that cannot grant CAP_SYS_NICE, instead of relying on the kernel's EPERM fallback path.

Adds docs/deployment/kubernetes.md covering Pod manifests for SQPOLL-enabled and SQPOLL-suppressed workloads, daemon-as-Pod deployment, Pod Security Admission profile interactions, and the tradeoff table. Extends docs/deployment/container-io-uring.md (IKV-F.6) with a K8s rootless-opt-out subsection and adds the new flag to docs/deployment/io-uring-feature-matrix.md.

Bundles SQP-K8S.1 / .3 / .4 (#4004 / #4006 / #4007). The rootless throughput bench (SQP-K8S.2) requires container access and is deferred to a follow-up PR.
oferchen added a commit that referenced this pull request Aug 24, 2026
* test: add AIMD convergence tests under error injection (#2092)

Drives the token-bucket bandwidth limiter through an
Additive-Increase/Multiplicative-Decrease control loop and verifies the
observed throughput tracks the configured rate at every stage: steady
state under no errors, multiplicative decrease on simulated error,
recovery via additive increase, stability under intermittent errors, and
clamping at the minimum rate floor.

All assertions use the deterministic recorded sleep durations from the
test-support infrastructure to remain free of wall-clock flakiness.

* style: apply cargo fmt to aimd convergence tests
oferchen added a commit that referenced this pull request Aug 24, 2026
* test: add AIMD convergence tests under error injection (#2092)

Drives the token-bucket bandwidth limiter through an
Additive-Increase/Multiplicative-Decrease control loop and verifies the
observed throughput tracks the configured rate at every stage: steady
state under no errors, multiplicative decrease on simulated error,
recovery via additive increase, stability under intermittent errors, and
clamping at the minimum rate floor.

All assertions use the deterministic recorded sleep durations from the
test-support infrastructure to remain free of wall-clock flakiness.

* style: apply cargo fmt to aimd convergence tests
oferchen added a commit that referenced this pull request Aug 24, 2026
Adds a fourth IoUringPolicy variant (SqpollOff) wired to the new --no-io-uring-sqpoll flag. The variant keeps io_uring active for file and socket I/O but suppresses IORING_SETUP_SQPOLL via a process-wide gate that build_ring() and the session-pool ring builder consult. This gives operators a deterministic opt-out for rootless containers and Kubernetes pods that cannot grant CAP_SYS_NICE, instead of relying on the kernel's EPERM fallback path.

Adds docs/deployment/kubernetes.md covering Pod manifests for SQPOLL-enabled and SQPOLL-suppressed workloads, daemon-as-Pod deployment, Pod Security Admission profile interactions, and the tradeoff table. Extends docs/deployment/container-io-uring.md (IKV-F.6) with a K8s rootless-opt-out subsection and adds the new flag to docs/deployment/io-uring-feature-matrix.md.

Bundles SQP-K8S.1 / .3 / .4 (#4004 / #4006 / #4007). The rootless throughput bench (SQP-K8S.2) requires container access and is deferred to a follow-up PR.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant