Rate Limiting, Throttling and Quota Management Questions
Protecting API capacity and enforcing fair use: rate-limiting algorithms (token bucket, leaky bucket, fixed/sliding window), per-client quotas, throttling responses (429 semantics, Retry-After), and tiered plan enforcement. Covers where to enforce limits (gateway vs. service), distributed counters, and graceful degradation under load.
Technical: Implement a thread-safe token-bucket rate limiter in Python that supports burst capacity, refill rate (tokens/sec), and a non-blocking allow_request(key) API suitable for per-user inference throttling. Explain assumptions and how you'd extend this to a distributed environment.
Design admission control and rate-limiting for a public ML prediction API that must protect expensive models. Policies must support per-user, per-api-key, and per-IP limits, burst allowances, priority tiers, and integration with billing. Explain algorithmic choices (token-bucket, leaky-bucket), distributed enforcement, and trade-offs between accuracy and performance.
Design a distributed rate limiter (token-bucket) to enforce per-user request limits across many stateless inference instances using Redis as the coordination layer. Describe the algorithm or pseudo-code (including atomic Redis operations or Lua), how you guarantee atomic updates, and how you mitigate clock skew and Redis hot keys.
That is every published Rate Limiting, Throttling and Quota Management question for AI Engineer so far. Browse the other topics in this category, or practice this one interactively.