Optimizing High-Concurrency LLM Inference for Explosive Token Growth

    As large language model usage scales rapidly, inference systems must handle massive increases in token volume without sacrificing latency or cost efficiency. This article examines the main performance bottlenecks in LLM inference, including Prefill computation, Decode memory bandwidth, and GPU memory fragmentation. It also covers continuous batching, PagedAttention, attention optimization, traffic management, intelligent routing, autoscaling, and cloud-native infrastructure practices for building high-throughput, low-latency inference services.

    Recent industry data shows that a leading large language model processed tens of billions of tokens in a single month, with usage increasing by more than sevenfold. As large language models (LLMs) become deeply integrated into business applications, traffic surges at this scale place significant pressure on compute scheduling, inference engine optimization, and overall service architecture.

    For enterprises, the central infrastructure challenge is to increase token throughput by orders of magnitude while maintaining low latency. This article analyzes the primary performance bottlenecks in LLM inference and discusses engineering practices for handling high-concurrency workloads.

    1. Key Performance Bottlenecks in Large-Scale Token Processing

    LLM inference is fundamentally an autoregressive generation process. This creates both compute-intensive and memory-intensive workloads when the system handles a large number of requests. Inference can generally be divided into two stages: Prefill and Decode.

    1.1 Compute Bottlenecks in the Prefill Stage

    During Prefill, the model processes the entire input prompt at once. Long input sequences result in intensive matrix multiplication, or GEMM, operations. The primary bottleneck in this stage is GPU compute capacity, measured in FLOPS.

    When a system receives a large number of concurrent requests, the substantial computational workload generated by Prefill can quickly saturate the GPU’s compute units.

    1.2 Memory Bandwidth Bottlenecks in the Decode Stage

    During Decode, the model generates output tokens one at a time. Each generation step must load the model weights and the KV Cache containing the history of previously processed tokens.

    Because only one token is typically generated at each step, computational density is relatively low. The bottleneck therefore shifts from compute capacity to GPU memory bandwidth. At tens-of-billions-of-token processing volumes, the resulting number of Decode operations makes memory bandwidth a critical constraint on throughput.

    1.3 GPU Memory Fragmentation

    In traditional static batching, input and output lengths can vary significantly between requests. This makes GPU memory fragmentation more likely and can eventually cause out-of-memory (OOM) errors. As a result, actual GPU utilization may decline substantially.

    2. Core Techniques for Increasing Token Throughput

    To address these bottlenecks, modern inference engines use a combination of optimization techniques designed to extract more performance from the available hardware.

    2.1 Continuous Batching

    Traditional batching groups requests when they arrive. The system generally must wait until the longest request in a batch finishes before releasing its resources, leaving the GPU idle while shorter requests complete.

    Continuous batching performs scheduling at the iteration level. When a request finishes generation, it is immediately removed from the active batch and replaced with a new request. This significantly reduces queueing delays and improves throughput during traffic peaks.

    2.2 KV Cache Management and PagedAttention

    Inspired by virtual memory paging in operating systems, PagedAttention divides the KV Cache into fixed-size blocks. Each block stores the Key and Value tensors for a fixed number of tokens.

    This non-contiguous allocation strategy greatly reduces memory fragmentation. It allows the system to schedule concurrent requests while using GPU memory at close to full capacity. During sudden increases in request volume, this approach helps maximize the utilization of available memory resources.

    2.3 Operator Fusion and Attention Optimization

    Replacing Multi-Head Attention (MHA) with Multi-Query Attention (MQA) or Grouped-Query Attention (GQA) can reduce the size of the KV Cache and lower memory bandwidth pressure during Decode.

    Operator-fusion techniques such as FlashAttention also reduce the number of reads from and writes to high-bandwidth memory (HBM), further accelerating both the Prefill and Decode stages.

    3. Service Architecture for High-Concurrency Inference

    Optimizing the inference engine alone is not enough to handle explosive traffic growth. A highly available and scalable inference service also requires appropriate architectural design.

    3.1 Traffic Gateways and Queue-Based Load Smoothing

    When the number of token requests rises sharply within a short period, sending requests directly to inference nodes can trigger cascading failures. The architecture should introduce an API gateway for authentication and rate limiting, together with a message queue such as Kafka for asynchronous decoupling and traffic smoothing.

    The gateway places inference requests into a queue, while inference workers retrieve requests as capacity becomes available. This helps keep the inference cluster operating at a stable load.

    3.2 Intelligent Routing and Load Balancing

    Traditional load balancing based only on connection counts is not well suited to LLM workloads. A request that generates a long response consumes considerably more resources than one that generates a short response.

    The load balancer should therefore be able to account for actual GPU utilization, including metrics such as memory usage and SM activity. New requests can then be routed to nodes with greater available capacity, reducing the risk of hotspots and uneven load distribution.

    3.3 Elastic Scaling

    A fixed-size cluster cannot reliably handle a sevenfold traffic increase. Elastic scaling based on cloud-native infrastructure is therefore essential.

    Autoscaling can be triggered by metrics such as queue depth, average request latency, and GPU utilization. When traffic subsides, the system can scale in automatically to reduce resource costs.

    The following example shows a Horizontal Pod Autoscaler (HPA) configuration for a general-purpose Kubernetes cluster. It demonstrates scaling based on custom metrics:

    1. apiVersion: autoscaling/v2
    2. kind: HorizontalPodAutoscaler
    3. metadata:
    4. name: llm-inference-hpa
    5. spec:
    6. scaleTargetRef:
    7. apiVersion: apps/v1
    8. kind: Deployment
    9. name: llm-inference-worker
    10. minReplicas: 3
    11. maxReplicas: 50
    12. metrics:
    13. - type: Pods
    14. pods:
    15. metric:
    16. name: gpu_memory_utilization
    17. target:
    18. type: AverageValue
    19. averageValue: "80" # Scale out when average GPU memory utilization reaches 80%
    20. - type: External
    21. external:
    22. metric:
    23. name: request_queue_depth
    24. target:
    25. type: AverageValue
    26. averageValue: 10 # Scale out when the request queue depth exceeds 10

    4. Implementation with Cloud-Native Infrastructure

    Infrastructure support is critical when building a high-concurrency LLM inference platform. Mainstream cloud providers, including Baidu AI Cloud, offer general-purpose infrastructure products that can support this type of deployment.

    With a container platform, enterprises can manage heterogeneous GPU resource pools and efficiently orchestrate and schedule inference workloads. Combined with logging, monitoring, and alerting capabilities, the platform can collect key inference metrics in real time, including token throughput, time to first token (TTFT), and time per output token (TPOT).

    When traffic increases several-fold, cloud-native infrastructure can respond within seconds by dynamically launching inference nodes equipped with high-performance GPUs. Object storage can support the rapid loading of large model weights, helping the service remain stable during traffic peaks.

    5. Conclusion

    The rapid growth of LLM requests and token processing is a natural consequence of AI moving toward large-scale production use. Simply adding more compute cannot fully address the latency and cost challenges introduced by high concurrency.

    A robust inference platform requires a deep understanding of the underlying LLM execution model, engine-level optimizations such as continuous batching and paged memory management, and a cloud-native architecture for elastic scheduling. Together, these practices enable high-throughput, low-latency, and cost-effective AI inference infrastructure that can handle future business growth.