Designing Service Continuity When LLM Compute Is Constrained
This article explains why generative AI inference capacity can run out unexpectedly and how engineering teams can keep services running under compute scarcity. It covers a three-tier quota model with sliding-window enforcement, caching and inference optimizations such as prefix caching, semantic caching, continuous batching, quantization, and output length governance, plus watermark-based elastic scheduling, transparent user communication and graceful degradation, and an observability and capacity forecasting loop that turns pausing new sign-ups into proactive admission control.
1. The Technical Root Cause: Why Inference Compute Suddenly Runs Short
When a generative AI product announces that compute is tight and new memberships are paused, outsiders often read it as a business decision. From an engineering standpoint, it is usually a visible signal that supply and demand on the inference side have fallen out of balance. Generative inference differs fundamentally from traditional request-response services: a single long-form generation task can run for tens of seconds or even minutes, holding GPU memory and compute units the entire time, and it cannot be reused as quickly as a stateless web request. Capacity planning for an inference cluster therefore has to be based on the number of concurrently resident sessions, not on requests per second.
The main sources of pressure fall into four categories:
- Context length growth: the complexity of attention computation grows superlinearly with sequence length, so a single request in a long-context scenario costs far more than a short question-answer exchange.
- Unpredictable peaks: hot events, version launches, and social sharing can create several multiples of normal traffic within an hourly scale.
- Incompressible resources: GPU memory is a hard constraint and cannot be offset by raising CPU utilization.
- Nonlinear cost: the marginal cost per token includes compute, bandwidth, and storage, so a low-priced plan combined with heavy usage erodes gross margin quickly.
In this light, “pausing new sign-ups” is essentially gate-style admission control: when the expansion cycle (procurement, racking, load testing, canary rollout) cannot keep pace with demand growth, limiting the inflow of new users protects the experience of existing ones. This is a common practice in observable systems.
2. Quotas: Turning a Scarce Resource into a Governable Metric
The first step in relieving resource pressure is not scaling up but making usage measurable, attributable, and limitable. A three-tier quota model is recommended:
- Account tier: a total cap per calendar month or rolling window, preventing a single account from consuming without bound.
- Session tier: a sliding quota with a fixed time window (such as five hours) as the granularity, suppressing short-term bursts.
- Request tier: caps on input and output tokens per request, concurrency, and timeout.
It is worth stressing that quota windows should use a sliding window or token bucket rather than a fixed calendar window; otherwise a “double consumption at the window boundary” spike appears. An illustrative implementation:
import timefrom collections import dequeclass SlidingWindowQuota:"""Sliding window quota: caps resource consumption per unit of time"""def __init__(self, window_seconds: int, max_units: int):self.window = window_secondsself.max_units = max_unitsself.events = deque()def try_acquire(self, units: int, now: float = None) -> bool:now = now or time.time()while self.events and now - self.events[0][0] > self.window:self.events.popleft()used = sum(u for _, u in self.events)if used + units > self.max_units:return Falseself.events.append((now, units))return True
Quota policy should be decoupled from billing: billing settles on usage, while quotas protect experience, and mixing the two makes the rules hard to explain. In addition, every rejected request should return a structured error code (for example, resource constrained, quota exhausted, suggested retry time) so clients can back off and retry.
3. Caching and Inference Optimization: More Effective Capacity on the Same Hardware
With hardware fixed, engineering optimization often pays off more than simply adding capacity. Suggested priority order:
- Prefix caching: reuse KV cache for system prompts, long-term memory, and fixed knowledge snippets; on a hit, that portion of prefill computation is skipped, which pays off notably with long fixed prefixes.
- Semantic caching: build a vector index for frequent similar questions and return historical results directly on a hit; set a similarity threshold and invalidation policy to avoid stale answers.
- Batch scheduling: use continuous batching to merge the decode phases of different requests, improving GPU memory and compute utilization.
- Quantization and distillation: within an acceptable quality range, use low-bit quantization or a smaller model for simple intents, and route complex requests to the large model.
- Output length governance: cap max_tokens by default and constrain verbose output through prompting; a long tail of lengthy outputs is a common cause of cost blowups.
Pseudocode for the routing strategy:
def route(request):if semantic_cache.hit(request, threshold=0.92):return semantic_cache.answer(request)if request.estimated_complexity < 0.3:return small_model.generate(request, max_tokens=512)return large_model.generate(request, max_tokens=2048)
4. Elastic Scheduling and Capacity Watermark Management
The core of capacity governance is “detect early, respond in tiers.” Four watermark levels are recommended, each bound to an action:
| Watermark | Trigger condition | Automatic action |
|---|---|---|
| Normal | Utilization < 60% | Regular scheduling, new sign-ups open |
| Watch | 60%–80% | Disable semantic cache invalidation, throttle long context |
| Tight | 80%–92% | Pause new plans, queue-based admission |
| Critical | > 92% | Fall back to the small model, read-only access to historical sessions |
Supporting mechanisms include autoscaling based on queue length, cross-availability-zone traffic scheduling, priority queues (paid and interactive requests first, offline batch jobs can be delayed), and admission queuing with estimated wait time for burst traffic. All watermark and action changes must be written to the logging service with monitoring alerts configured, forming a traceable capacity decision chain.
5. User Experience and Degradation Plans: State the Limits Clearly
Limits themselves are not frightening; opaque rules are what damage trust. Practices that work in production:
- Advance notice: state quotas, window periods, and overage behavior clearly on the plan page, avoiding after-the-fact explanations.
- Lossless degradation: automatically shorten output length during peaks and reduce the call frequency of non-core features (such as deep retrieval) to keep the main path available.
- Existing user protection: keep existing entitlements unchanged, support renewal and smooth plan upgrades, and clearly show remaining quota and recovery time in the interface.
- Status page and announcements: publish capacity status on a unified status page to reduce the extra load from repeated inquiries.
6. Observability and the Capacity Forecasting Loop
Finally, tie these capabilities into a loop: collect metrics such as token usage, cache hit rate, queue time, time to first token, and failure rate; build usage dashboards by hour and by plan; use historical data for cyclical and trend forecasting, and place orders one expansion cycle ahead; run capacity load tests and canary ramp-ups before each release, turning “pausing new sign-ups” from reactive firefighting into proactive admission adjustment.
For developers, the conclusion is clear: compute scarcity is a phase-level, objective constraint. What really determines service resilience is the engineering maturity of four things: quota governance, cache reuse, elastic scheduling, and transparent communication. Running on a cloud environment with general-purpose capabilities such as a container platform, object storage, logging, and monitoring alerts, Baidu AI Cloud for example, lets teams build this watermark-driven capacity governance system faster and minimize the impact of resource fluctuation on user experience.
