Skip to content

feat(layers/aimd): add adaptive HTTP request pacing - #8329

Draft
Xuanwo wants to merge 4 commits into
mainfrom
xuanwo/aimd-layer
Draft

Xuanwo wants to merge 4 commits into
mainfrom
xuanwo/aimd-layer

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Sep 21, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #8036.

Rationale for this change

Fixed concurrency and bandwidth limits do not adapt to backend request-rate throttling. Add an optional AIMD layer that paces HTTP requests and adjusts its rate from OpenDAL's typed RateLimited feedback.

What changes are included in this PR?

  • Add opendal-layer-aimd with independent read, write, delete, and list token buckets. Active windows increase rates additively; windows observing RateLimited decrease them multiplicatively within configured bounds. Empty windows leave rates unchanged.
  • Admit each HTTP request carrying an OpenDAL Operation marker, including pagination and multipart requests. Observe parsed errors through service and I/O wrappers. Unmarked requests, presigning, and non-HTTP I/O bypass pacing.
  • Use asyncband for FIFO admission and cancellation without token debt. Cloned layers share budgets across operators and context replacement. Default to Tokio timers and allow callers to supply a sleep function with with_sleep.

Admission counts HTTP requests, while feedback belongs to the enclosing storage operation; composite operations may use multiple request categories. The controller therefore uses the presence of RateLimited, rather than a ratio of errors to requests. Pacing occurs after signing, and transport-internal redirects or retries are outside the admission boundary.

Are there any user-facing changes?

Enable layers-aimd to use opendal::layers::{AimdConfig, AimdLayer}, or depend on the standalone layer crate. Add AIMD before a retry layer so it observes each attempt's errors. The layer does not retry or change error semantics. Existing users are unaffected unless they opt in.

Breaking changes

AI Usage Statement

  • Harness: Codex desktop.
  • Model: gpt-6-astra.
  • Effort: high.
  • Role: Researched the design, implemented the layer and focused tests, and prepared this PR under human direction. Validation covers local algorithm and layer behavior; adaptive behavior against a live storage service has not been measured.

@github-actions github-actions Bot added core releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:XXL This PR changes 1000+ lines, ignoring generated files. labels Sep 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core releases-note/feat The PR implements a new feature or has a title that begins with "feat" size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

new feature: add AimdLayer for adaptive request-rate control

1 participant