Rate Limiting and Degradation for LLM Services Under High Concurrency
This article examines why large language model (LLM) inference services are especially prone to overload, and how to keep them stable under high concurrency. It covers the root causes of overload amplification, tiered rate limiting with token bucket logic, concurrency and cost limits, context governance to cut per-request cost, graceful degradation and queuing, caching and capacity planning, and observability plus failure drills. The goal is to allocate scarce resources to the most valuable requests and make overload behavior predictable.
1. The Problem: Why LLM Services Get Overwhelmed So Easily
A cloud provider’s LLM service recently experienced sustained instability under heavy load and, for the first time, imposed call limits on free users. Setting the specific product aside, this exposes a general engineering problem: LLM inference resources are scarce and rigid, while user request arrivals are bursty and unpredictable. When the two are mismatched, the server side has no choice but to protect itself through rate limiting, queuing, or degradation.
Compared with traditional web services, LLM inference has three distinct resource characteristics:
- Each request holds resources for a long time. A single generation can last from several seconds to tens of seconds, and GPU memory and compute slots are held exclusively for the entire decoding cycle. They cannot be released in milliseconds the way stateless HTTP requests are.
- Resource consumption is strongly tied to input length. The longer the context, the more memory and compute attention calculations require, and long-text requests significantly drag down overall throughput.
- Scaling out is not linear. Adding replicas brings problems such as memory fragmentation and reduced scheduling and batching efficiency. You cannot simply scale horizontally by adding machines to handle QPS.
So the core of stability work is not “throwing more GPUs at it,” but allocating limited resources to the most valuable requests and making behavior under overload controllable and predictable.
2. Root Cause Breakdown: How Overload Gets Amplified
Overload is rarely a single point of failure. It is usually a positive feedback loop of several factors stacking up:
- Traffic bursts: Hot events, marketing campaigns, or concentrated working hours can multiply request volume within seconds.
- Long-context amplification: Some users keep appending conversation history, so the context carried by each request keeps expanding and the cost per request rises several times over.
- Retry storms: Clients retry immediately after a timeout, so request volume goes up rather than down during an outage, creating an avalanche.
- No priority differentiation: Paid and free users, online interaction and offline batch jobs all share the same resource pool, so high-value requests get crowded out by low-value ones.
Only by understanding these amplification paths can you apply the right fix.
3. Rate Limiting: Keeping Inbound Traffic Within Capacity
Rate limiting is the first gate. The goal is to keep the rate of requests entering the system from exceeding the backend’s real processing capacity.
Tiered rate limiting is the key. It is advisable to allocate quotas by user type and business importance—for example, splitting requests into three tiers: interactive online, standard calls, and offline batch, each with different rate limits and concurrency limits. Illustrative token bucket logic:
class TokenBucket:def __init__(self, capacity, refill_rate):self.capacity = capacity # Bucket capacity; allows some burstself.tokens = capacityself.refill_rate = refill_rate # Tokens added per seconddef allow(self, now):self.tokens = min(self.capacity,self.tokens + (now - self.last) * self.refill_rate)self.last = nowif self.tokens >= 1:self.tokens -= 1return Truereturn False
Beyond rate limiting, you should also set concurrency limits (capping the number of requests decoding at the same time) and cost limits (budget-style constraints on total input and output tokens), because for LLMs, controlling “how many long requests are running at once” protects GPU memory better than controlling QPS.
4. Context Governance: Cutting Per-Request Cost at the Source
The original material notes that removing conversation history is intended to reduce the chance of historical content being reactivated, thereby lowering the frequency of long-context processing. This idea can be generalized as context governance, one of the most effective cost-side measures:
- Sliding window and summary compression: Keep only the most recent few turns and summarize older content instead of carrying it in full.
- Session TTL and proactive cleanup: Set an expiration time for historical sessions and archive them automatically once expired, avoiding unbounded growth.
- On-demand retrieval instead of full concatenation: Use retrieval to fetch only the fragments relevant to the current question, rather than stuffing the entire history into the context.
Halving the context noticeably reduces memory and compute overhead for attention, which is equivalent to increasing system throughput.
5. Degradation and Queuing: Controllable Retreat Under Overload
When rate limiting alone cannot absorb the traffic, you need graceful degradation strategies rather than outright errors:
- Asynchronous queuing: Write requests to a message queue and return a task identifier; the client polls or receives a callback to get the result, turning a long synchronous wait into an asynchronous one.
- Capability degradation: During peak periods, automatically shorten the maximum output length, disable non-essential multi-turn memory, and switch to a lighter model size.
- Fallback results: For tolerable scenarios, return cached results or templated replies so users never face a blank screen.
- Retry governance: Clients use exponential backoff with jitter, and the server returns an explicit “retry later” semantic to avoid retry storms.
6. Caching and Capacity Planning: Improving Effective Throughput
- Semantic caching: Cache results for high-frequency similar questions and return them on a hit, directly reducing inference calls.
- Batch scheduling: Merge multiple short requests into a batch to improve GPU utilization, while weighing this against the low-latency needs of online traffic.
- Capacity and elasticity: Build a capacity baseline from historical peaks and reserve an elastic buffer; combine monitoring and alerting to scale out or throttle before metrics breach limits.
- Multi-availability-zone disaster recovery: Deploy across availability zones with traffic scheduling to prevent a single point of overload from spreading into a global outage.
7. Observability and Drills
Stability is data-driven. It is recommended to build monitoring and alerting for the following metrics: request rate, concurrent decodes, context length distribution, queue latency, timeout rate, number of degradation triggers, and cache hit rate. Use failure drills to verify that rate limiting thresholds and the degradation path work as expected.
8. Conclusion
Overload governance for LLM services is essentially about building a buffer between “resource rigidity” and “traffic elasticity.” By constraining the entry point with tiered rate limiting, reducing per-request cost through context governance, keeping overload controllable with queuing and degradation, and improving effective throughput with caching and capacity planning, teams can hold the availability of core paths even when resources are constrained. For businesses that need to carry high-concurrency intelligence, using general capabilities from cloud platforms such as Baidu AI Cloud—container platforms, message queues, logging services, and monitoring and alerting—can help stand up this stability system faster.
