Skip to content

AdaptiveConcurrencyLimiter self-throttles to min_limit over time (min_rtt never resets, mixes non-2xx latencies) #215

Description

@ZhuchkaTriplesix

Where: oxyroute/resilience.py:9-78.

  • self.min_rtt is a running minimum that is set once and never decays/resets, and it's shared across all endpoints/routes rather than tracked per-route or in a sliding window.
  • on_request_completed is invoked from access_log_hook for every response including fast 404s and even the limiter's own 503 rejections, dragging min_rtt toward near-zero.
  • As min_rtt / avg_rtt trends toward 0, the Vegas-style gradient computation drives current_limit down toward min_limit permanently, increasing rejections, which are themselves fast and further lower min_rtt — a feedback loop that ratchets concurrency down and never recovers.
  • Separately, as_access_log_hook's wrapped hook receives duration_seconds per its parameter name, but App.__rsgi__ (oxyroute/app.py:812) passes duration in milliseconds — units mismatch compounds the above.

Fix direction: use a windowed/decaying minimum (not all-time), exclude non-2xx and self-rejected requests from the RTT sample, track per-route or use a global gradient with a sqrt(limit)-style headroom term (as in TCP Vegas/gradient2), and fix the seconds-vs-milliseconds mismatch.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions