Skip to content

feat: adapt model concurrency to downstream 529 responses - #1460

Open
pjb157 wants to merge 1 commit into
mainfrom
peter/adaptive-529-throttle
Open

feat: adapt model concurrency to downstream 529 responses#1460
pjb157 wants to merge 1 commit into
mainfrom
peter/adaptive-529-throttle

Conversation

@pjb157

@pjb157 pjb157 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a per-daemon, per-model AIMD controller that halves claim concurrency on exact downstream HTTP 529 responses and recovers additively
  • share adaptive capacity across foreground/background request and batch claim loops, including route-at-claim escalation
  • expose the recovery interval through configuration and add limit/change metrics plus operator documentation

Tests

  • SQLX_OFFLINE=true just lint rust
  • just test rust
  • focused adaptive-concurrency unit and integration tests, including cross-loop feedback and escalation capacity accounting

Copilot AI lite review requested due to automatic review settings August 8, 2026 18:15
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying control-layer with  Cloudflare Pages  Cloudflare Pages

Latest commit: 384e383
Status: ✅  Deploy successful!
Preview URL: https://f72be175.control-layer.pages.dev
Branch Preview URL: https://peter-adaptive-529-throttle.control-layer.pages.dev

View logs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an adaptive per-daemon, per-model AIMD concurrency controller to fusillade so claim capacity reacts to downstream overload (HTTP 529) by halving effective limits and then recovering additively, with shared feedback across claim loops (foreground/background and batch) and operator-facing configuration/docs.

Changes:

  • Introduces an AdaptiveConcurrencyController and wires it into claim-capacity calculations plus per-request success/overload feedback.
  • Extends daemon configuration surfaces (fusillade + dwctl + config.yaml) with adaptive_concurrency_recovery_interval_ms, including mapping and tests.
  • Adds integration/unit tests and documentation describing the adaptive behavior and its metrics.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
fusillade/tests/integration.rs Adds integration tests covering 529-triggered halving, cross-loop sharing, and escalation accounting.
fusillade/src/daemon/mod.rs Integrates adaptive concurrency into capacity computation and request completion feedback; adds metrics/logging and tests.
fusillade/src/daemon/config.rs Adds configurable recovery interval with default + serde behavior and a round-trip test.
fusillade/src/daemon/adaptive_concurrency.rs New AIMD controller implementation with unit tests.
fusillade/README.md Documents adaptive concurrency behavior and the new configuration knob.
dwctl/src/config.rs Exposes and maps the new fusillade knob through dwctl config, with defaulting + tests.
config.yaml Documents the new config key in the sample configuration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1249 to +1260
if is_downstream_overload(&failed.state.reason)
&& let Some(configured_limit) = model_concurrency_limits
.get(&capacity_model_clone)
.map(|limit| *limit)
&& let Some(adjustment) = adaptive_concurrency.record_overload(
&capacity_model_clone,
configured_limit,
Instant::now(),
)
{
emit_concurrency_decrease(&capacity_model_clone, adjustment);
}
Comment on lines +1208 to +1218
if let Some(configured_limit) = model_concurrency_limits
.get(&capacity_model_clone)
.map(|limit| *limit)
&& let Some(adjustment) = adaptive_concurrency.record_success(
&capacity_model_clone,
configured_limit,
Instant::now(),
)
{
emit_concurrency_increase(&capacity_model_clone, adjustment);
}
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.

2 participants