Engineering LLM Capacity and Stability Under Compute Constraints
This article examines how engineering teams can build sustainable large language model serving capacity when compute supply is constrained but demand keeps growing. It covers quantitative capacity planning based on latency percentiles rather than averages, scheduling techniques such as continuous batching, priority queues, and workload pooling, stability practices including dependency isolation and graceful degradation, and the observability metrics needed to guide capacity decisions. It also outlines ways to rebalance cost and efficiency through caching, speculative decoding, model routing, and off-peak resource reuse.
1. The Signal Behind the Funding: Capital Speed vs. Compute Constraints
A large language model company recently completed a significant equity restructuring: registered capital rose slightly, while the entity serving as a unified holding platform for external investment saw its subscribed capital jump by an order of magnitude. The number of new partners reached several dozen, led by industrial capital. Market reports cited different post-money valuations, none confirmed by the company. Public information also showed that the company had closed another round a few months earlier, with the combined amount being substantial.
Valuation figures carry no direct technical meaning for engineering teams. Three underlying signals matter more:
- Capital is going mainly into long-cycle investments such as compute and talent. LLM training and inference are capital- and energy-intensive, so funding pace directly determines how fast clusters can expand.
- Supply is hard-constrained. Public information noted that the company tightened usage limits for free users late last year and experienced dozens of service outages or performance degradations during the year, indicating demand growth has outpaced resource delivery.
- A changing shareholder base implies a more complex workload mix. With industrial capital on board, industry-specific and scenario-specific inference requests will increase significantly, shifting both peak-to-trough patterns and long-tail distributions.
The general engineering problem is therefore: how to build a sustainable LLM service capacity system and stability governance mechanism when compute supply is limited and demand is growing fast.
2. Capacity Planning: From “Adding GPUs” to a Measurable Capacity Model
Capacity planning cannot rely on intuition about how many GPUs exist or how many requests they can serve. It needs a reusable quantitative model with at least these variables:
- Average input and output length distributions per request (use P50/P90/P99, not the mean);
- Target throughput (tokens/s) and concurrency ceiling;
- Service targets for time to first token (TTFT) and overall latency (TPOT);
- Effective throughput per GPU or node at a given precision and batching strategy;
- A redundancy factor for traffic spikes and node removal during failures.
A simplified capacity estimation sketch (pseudocode, expressing calculation logic only):
# Illustrates capacity estimation logic only; not any specific product APIdef estimate_nodes(req_per_sec, avg_out_tokens, tpot_target_ms,per_node_throughput, redundancy=1.3):# Duration a single request occupies (seconds), from output length and per-token latencyduration = avg_out_tokens * (tpot_target_ms / 1000.0)# Number of requests that must be in flight concurrentlyconcurrency = req_per_sec * duration# Convert to node count using effective per-node throughput, with redundancynodes = concurrency / per_node_throughput * redundancyreturn {"concurrency": concurrency, "nodes": int(nodes) + 1}
The key point: averages severely underestimate resource needs. Inference time and memory usage grow non-linearly with context length, and long-context requests can consume several times the resources of short ones. Capacity models must therefore take percentile inputs and give long-context requests dedicated resource pools and quotas.
3. Resource Scheduling: Batching, Priorities, and Pooling
With a fixed resource pool, scheduling policy sets the ceiling on usable capacity. Common industry practice falls into three layers.
Layer 1: Continuous batching and paged memory management. Static batching wastes cycles when long and short requests are mixed; continuous batching lets a request release its slot as soon as generation finishes, substantially improving effective utilization. Combined with paged key-value cache management, it reduces memory fragmentation and raises the concurrency a node can hold.
Layer 2: Request classification and priority queues. Split traffic into interactive, batch, and internal offline tasks, each bound to different service targets and resource quotas. Interactive requests get first-token latency protected; offline tasks can be preempted at any time.
Priority, highest to lowest:P0 Interactive chat (strict TTFT target, no queue timeouts allowed)P1 Critical business calls (seconds of queueing tolerable)P2 Batch summarization / offline evaluation (preemptible, retryable)
Layer 3: Physical pooling and affinity scheduling. Deploy high-consumption workloads such as long-context and multimodal requests in separate pools from regular short requests to avoid interference. Schedule sessions with cache reuse value onto the same node where possible to raise prefix cache hit rates and cut redundant computation.
4. Stability Governance: Turning “Outage Count” into an Optimizable Metric
The outages and performance degradations mentioned publicly are essentially gaps in stability engineering. Four areas to close them:
- Dependency decoupling and fault isolation. The inference path depends on model weight storage, vector retrieval, caches, and message queues; jitter in any one amplifies into user-visible failure. Give each dependency type its own timeout, circuit breaker, and bulkhead isolation.
- Overload protection instead of infinite queueing. When concurrency passes a threshold, actively rejecting or degrading requests beats letting them pile up. Combine queue-length-based and token-bucket rate limiting, and return a clear retryable signal to rejected requests.
- Graceful degradation paths. Define an explicit ladder: disable non-core enhancements (retrieval augmentation, complex reranking) → shorten maximum output length → switch to a smaller model → return cached or templated responses.
- Routine chaos drills and capacity load testing. Inject node failures, dependency timeouts, and network partitions in a staging environment to verify that automatic removal and recovery times meet targets.
5. Observability: Making Capacity Decisions Evidence-Based
No measurement, no optimization. A minimal observability system covers three data types:
- Metrics: concurrency, queue wait time, TTFT and TPOT percentiles, memory and cache hit rates, cost per request;
- Logs: structured records of request length, routing target, degradation flags, and failure reasons, for aggregation across dimensions;
- Tracing: linking gateway, scheduler, inference, and external dependencies to locate latency bottlenecks.
On top of this, build capacity dashboards and tiered alerts: “approaching quota” as a warning, “degradation triggered” as an event, and “service unavailable” as an incident, each bound to a different response process. In the cloud, container platforms typically handle elastic scaling, object storage holds models and datasets, message queues smooth traffic spikes, and logging plus monitoring services handle data collection and notification. Baidu AI Cloud offers standardized infrastructure categories for these general capabilities; specific choices should follow benchmark testing against your own workload characteristics.
6. Rebalancing Cost and Efficiency
Under compute constraints, cost optimization and experience protection are not opposed. Priorities worth pursuing first:
- Context compression and cache reuse: cache stable prefixes such as system prompts and long documents to avoid repeated prefill computation;
- Inference acceleration such as speculative decoding: raise output per unit of compute within acceptable quality bounds;
- Tiered model routing: classify intent and let a small model handle simple requests, escalating complex ones to a larger model;
- Reusing idle resources: run offline evaluation, data cleaning, and fine-tuning during nightly troughs to lift overall utilization.
7. Conclusion
Funding and valuation belong to the capital narrative. What engineering teams must answer is how to convert limited compute into predictable service quality when resource delivery lags demand growth, using capacity models, scheduling policies, stability mechanisms, and observability. Distilling these four capabilities into reusable platform capabilities is what lets engineering certainty offset resource uncertainty when the next traffic peak arrives.
