Elastic Architecture and Resource Scheduling for LLM Serving Under Compute Constraints
As large language model services face tightening compute supply, this article explains the root causes of compute pressure and presents a practical architecture for improving resource utilization. It covers resource pooling, multi-tenant isolation, tiered scheduling with preemption, elastic reservation, model quantization and routing, continuous batching, KV Cache reuse, semantic caching, autoscaling, rate limiting, graceful degradation, capacity planning, observability, and cost governance. The goal is to show how teams can sustain stable, cost-effective LLM services without simply adding more accelerators.
1. Why Compute Becomes Constrained: From Symptoms to Root Causes
Recently, several large language model services have adjusted their access policies, with “compute pressure” often cited as the surface reason. However, the underlying issue is a structural mismatch between supply and demand. To understand this problem, it is necessary to break “compute” into measurable engineering resources.
Compute consumption for large models comes mainly from two scenarios. First, training and fine-tuning require high memory capacity and interconnect bandwidth, and are typically phase-based and concentrated consumption. Second, online inference happens in real time with user requests and is highly volatile and unpredictable. When inference traffic grows sharply over a short period, but GPU procurement and cluster expansion have delivery cycles, the supply curve cannot keep up with the demand curve, leading to resource strain.
The key point is this: the real bottleneck of compute pressure is often not the number of accelerators, but the output efficiency per unit of compute. For the same accelerator, whether scheduling, batching, and quantization can extract higher effective throughput directly determines the service capacity ceiling. Therefore, the response to compute pressure should move beyond “buying more GPUs” toward “making every unit of compute as effective as possible.”
2. Resource Side: Compute Supply and Scheduling Strategies
When hardware resources are fixed, scheduling is the first lever for improving overall utilization.
1. Resource pooling and multi-tenant isolation
Accelerator resources should be pooled and managed centrally through a container platform to prevent a few long-running tasks from monopolizing resources for extended periods. For workloads with different priorities and SLAs, independent resource queues or quotas should be established to prevent mutual contention.
2. Tiered scheduling and preemption
Tasks should be classified by priority. Highly sensitive tasks such as online inference should receive higher priority, while delay-tolerant tasks such as offline batch processing and model evaluation can serve as low-priority fillers for idle compute. When high-priority tasks arrive, low-priority tasks should be preemptible or queued.
# Illustrative: scheduling decision based on priority and wait timedef schedule_task(task_queue, free_gpus):# Sort tasks by priority and wait time to balance fairness and responsivenesstask_queue.sort(key=lambda t: (t.priority, -t.wait_time), reverse=True)for task in task_queue:if free_gpus >= task.required_gpus:yield taskfree_gpus -= task.required_gpus
3. Elastic reservation and tidal scheduling
Business traffic often shows clear daily or weekly tidal patterns. A “baseline reservation plus elastic overflow” model can be used: the baseline portion guarantees always-on services, while the overflow portion is temporarily scheduled during peak periods. The elastic scaling and container capabilities of platforms such as Baidu AI Cloud can serve as infrastructure references for implementing this model.
3. Application Side: Model and Inference Optimization
Without changing the hardware, optimizing models and inference paths is the most direct way to increase effective compute.
1. Model lightweighting
- Quantization: Reduce model weights from high-precision to low-precision representations, significantly reducing GPU memory usage and computation.
- Distillation and pruning: Use large models to guide smaller models, or remove redundant parameters while maintaining accuracy.
- Model tiered routing: Simple requests are handled by smaller models, and only complex requests are escalated to larger models, avoiding wasteful use of expensive models for simple tasks.
2. Inference batching
Combining multiple requests into one batch can significantly improve GPU utilization. Continuous batching, which dynamically adds or removes requests in the sequence dimension, can substantially reduce idle gaps compared with static batching. At the same time, KV Cache reuse allows requests with shared prefixes to avoid repeated computation, which is especially effective for multi-turn conversations and scenarios with identical system prompts.
# Illustrative: request routing by complexity to save computedef route_request(request):if request.estimated_complexity < SIMPLE_THRESHOLD:return dispatch_to(small_model_pool, request) # Lightweight modelelse:return dispatch_to(large_model_pool, request) # High-precision model
3. Caching and result reuse
For high-frequency and highly repetitive queries, a semantic cache can be introduced. When there is a cache hit, historical results are returned directly, bypassing a large amount of repeated inference overhead. Reasonable expiration policies should be used to avoid returning stale data.
4. Architecture Side: Elastic Design and Capacity Planning
The core tension of compute pressure is that peak demand far exceeds average capacity. Therefore, elasticity must be built into the architecture.
1. Auto-scaling
Scaling signals should include queue length, request latency, and GPU utilization, rather than relying on a single CPU metric. When inference queues continue to back up, scale out quickly; during low-demand periods, scale in promptly to release resources and avoid holding excess compute long-term just to handle peaks.
# Illustrative: triggering elastic scale-out based on queue metricsdef autoscale_decision(metrics):target_queue = 10desired = ceil(metrics.queue_length / target_queue)desired = max(min_replicas, min(desired, max_replicas))if metrics.gpu_utilization > 0.85 and metrics.p95_latency > LATENCY_SLO:desired += 1 # Scale out ahead of peak periods and keep a bufferreturn desired
2. Rate limiting, queueing, and graceful degradation
When compute is already at its limit, requests should not be allowed to flood the system without control. Admission control should be established: requests that exceed capacity should enter a queue, and those exceeding thresholds should be rate-limited. In extreme cases, degradation strategies can be triggered, such as returning results from a lightweight model, reducing generation length, or prompting users to retry later. This protects the stability of core services and gives users clear expectations.
3. Capacity planning model
Capacity planning should be based on historical traffic distributions and should be quantifiable, distinguishing baseline capacity from peak elastic capacity. Effective throughput per instance should be determined through load testing, and the required number of replicas and reserved resources can then be estimated based on traffic forecasts, avoiding arbitrary decisions.
5. Observability and Cost Governance
When compute is constrained, waste cannot be eliminated if it cannot be seen.
1. Key monitoring metrics
- Resource layer: GPU utilization, GPU memory usage, and batch fill rate.
- Service layer: request queue time, P95/P99 latency, and token throughput.
- Business layer: cache hit rate, degradation trigger rate, and rate-limiting ratio.
These metrics can be integrated into logging and monitoring/alerting systems to form a complete view from resources to business.
2. Cost allocation and budget alerts
Compute consumption should be measured and allocated by business line or tenant to identify high-consumption, low-value call sources. Budget alerts should be configured so that interventions can be made when consumption deviates from expectations, directing compute toward requests that create real value.
3. Capacity watermark and capacity alerts
Watermarks should be set for resource pools. When the alert threshold is exceeded, capacity expansion evaluation or a degradation plan should be triggered automatically, turning passive firefighting into proactive prevention.
6. Conclusion
Compute pressure is not simply a shortage of hardware, but an engineering test of resource efficiency and architectural resilience. The real solution is not to keep stacking accelerators without limit, but to coordinate efforts across three layers: on the resource side, implement tiered scheduling and elastic reservation; on the application side, increase effective compute output through model lightweighting and inference optimization; and on the architecture side, protect service baselines with auto-scaling, rate limiting, graceful degradation, and quantitative capacity planning. When every unit of compute can be scheduled precisely and every demand peak can be handled elastically, AI services can remain efficient, stable, and sustainable even under tightened supply.
