LLM Services Slow Down or Time Out: Five Root Causes and Mitigation Strategies

    This article provides a practical framework for diagnosing and mitigating slow or timed-out large language model services. It covers two common deployment models, five high-frequency root causes, a layered troubleshooting path from ingress to inference, and stability practices such as admission control, circuit breaking, degradation, caching, autoscaling, observability, and post-incident review.

    1. Define the Scope First

    How should you troubleshoot slow responses from an LLM service? The approach in this article applies to two scenarios. One is a self-hosted inference cluster, where the team manages GPUs, the inference framework, and the gateway. The other is a cloud-managed inference service, where the underlying resources are managed by the cloud provider, but the gateway, routing, rate limiting, and business dependencies are still owned by the team. The range of metrics available differs between the two scenarios. When using third-party model APIs, inference-layer metrics cannot be obtained directly, so gateway-side time to first token (TTFT), end-to-end latency, and error codes must be used instead.

    The “service abnormalities” perceived by users usually include requests that do not respond for a long time, slower generation speed, a rising proportion of error codes, failures in some sessions, a “busy” page prompt, or even complete unavailability for a short period. Most of these symptoms are not caused by a complete service crash. They are more often caused by local overload or link congestion resulting from multiple factors combined. When traffic surges, long-text requests increase, cache hit rate drops, or compute resources become tight, the system may enter a loop of queuing, timeouts, and retry amplification.

    Therefore, the first step in troubleshooting is to establish an observability framework. First confirm whether the abnormality is in the ingress layer, inference layer, cache layer, or dependency layer. Then determine whether the cause is insufficient capacity, abnormal traffic, dependency jitter, or a problem introduced by a change. Restarting or scaling up directly before the problem is clearly located may hide the root cause and may cause the problem to reappear at the next peak.

    2. Five High-Frequency Root Causes

    2.1 Traffic Surges and Changes in Request Structure

    Traffic fluctuations in LLM services are usually more severe than in traditional web services. Campaigns, hot events, or concentrated usage on weekday mornings can all cause short-term concurrency increases. Changes in request structure can also amplify pressure. Long context, multi-turn conversations, complex instructions, and batch generation all significantly increase the latency and resource consumption of a single inference request.

    If capacity is evaluated only by request count, the system can easily exhaust resources in scenarios where “request count is not high, but each request is heavy.” A more reliable approach is to use request cost instead of request count. It can be estimated as follows:

    Request cost ≈ input tokens × (1 − cache hit ratio × 0.9) + max output tokens

    The cache-hit portion is counted at a lower cost. Output is counted at the upper limit because the actual output length cannot be known in advance at admission time. The coefficient 0.9 is only an example and should be based on the measured prefix-cache savings ratio.

    When estimating capacity, you can run load tests as follows:

    1. Bucket requests by input length, for example short text (less than 1k tokens), medium (1k to 8k tokens), and long text (more than 8k tokens).
    2. For each bucket, measure TTFT, full generation latency, and per-card throughput separately.
    3. Weight by the proportion of each bucket in historical traffic to derive the overall sustainable request cost.
    4. Reserve a certain margin as a starting point, for example 20% to 30%, and then adjust it based on the online timeout rate.

    2.2 Tight Compute Resources and Rising Inference Cost

    LLM inference is highly sensitive to compute and VRAM resources. The larger the model, the more compute and VRAM a single inference requires. As concurrency increases, the inference queue quickly becomes longer, TTFT slows down, and full generation time also increases. If the resource pool does not have sufficient elastic headroom, the system will gradually move from “slow” to “unavailable.”

    Differences between models, context lengths, and output lengths are also significant. Without request classification and resource isolation, a small number of high-consumption requests can occupy most resources and degrade service quality for other tenants.

    2.3 Pressure Backflow Caused by a Drop in Cache Hit Rate

    Caching reduces repeated computation and lowers response latency. Common caches include result caches, session caches, prefix caches, and intermediate-state caches. When cache hit rate drops, requests that could have been returned quickly re-enter the full inference path, and backend pressure surges.

    Causes of cache invalidation include insufficient capacity, unreasonable expiration policies, changes in hot data, request distribution drift, and unstable cache key design. Once the cache layer loses its buffering effect, traffic directly hits the inference layer, creating an amplification effect.

    2.4 Jitter in External Dependencies or Internal Components

    LLM services usually depend on components such as gateways, authentication, configuration centers, message queues, logging services, monitoring and alerting, and object storage. Latency or errors in any of these links can cause requests to pile up. Slow authentication can make requests queue at ingress. Blocking log writes can stall the main path. Abnormal configuration refresh can cause incorrect routing. Improper retry policies for dependent services can further expand the blast radius.

    2.5 Risks Introduced by Releases and Configuration Changes

    Many abnormalities do not come from capacity itself but from changes. Model version updates, prompt template adjustments, routing rule changes, rate-limit threshold modifications, cache policy changes, and resource quota adjustments can all trigger problems under specific traffic structures. When releases lack canary deployment, rollback, and observability mechanisms, a small-scale abnormality can quickly spread into a global failure.

    3. Troubleshooting Path: Locate Layer by Layer from Ingress to Inference

    3.1 Ingress Layer: Confirm Whether Requests Arrive

    First look at ingress-layer total requests, concurrent connections, error rate, average response time, and P95/P99 latency. If ingress request volume is normal but the error rate rises, the problem is usually in the backend. If ingress request volume surges abnormally, priority should be given to determining whether there is abnormal traffic or a retry storm.

    At the same time, check the proportion of duplicate requests, invalid requests, and excessively long requests. Abnormal traffic should be identified and blocked at the ingress layer to prevent invalid pressure from being passed to the inference layer.

    3.2 Gateway and Routing Layer: Confirm Whether Requests Are Distributed Correctly

    Focus on routing accuracy, load on each instance, rate-limit trigger count, circuit-break count, and queue length. When some nodes have significantly higher load, it may be due to uneven routing policies or failed health checks. In multi-model and multi-tenant scenarios, also confirm whether requests are incorrectly routed to high-load resource pools.

    3.3 Inference Layer: Determine Whether the Problem Is Overall Insufficiency or a Local Hotspot

    The inference layer is the focus of troubleshooting. Observe GPU utilization, VRAM usage, inference queue length, batching efficiency, per-request latency, and timeout ratio. A single metric is not enough to draw a conclusion. Combined criteria should be used:

    Symptom combination Preliminary judgment Follow-up action
    Queue keeps growing, GPU utilization stays above 85%, and P99 latency rises simultaneously Overall capacity insufficiency Scale out or rate limit, and verify the capacity model
    Queue grows, most instances have utilization below 50%, and a few instances are near the limit Local hotspot Check routing weights and isolate long requests
    Utilization is normal, latency rises, and dependency call latency rises simultaneously Dependency drag Move to dependency-layer troubleshooting
    Utilization is normal, latency rises, and batching efficiency drops Improper scheduling parameters Adjust batch size and wait window

    The thresholds in the table (such as 85% and 50%) are examples and should be adjusted based on the inflection point obtained from load testing. “Queue keeps growing” can be defined as a positive slope over the last 5 minutes, with most sample points higher than the previous one.

    The steps to distinguish overall insufficiency from a local hotspot are as follows:

    1. Break down GPU utilization and queue length by instance to see whether load is even.
    2. Break down request volume and latency by tenant and model to find the combinations consuming the most resources.
    3. Calculate the proportion of total resource consumption taken by the longest requests (for example, requests with input over 8k tokens). If the proportion is high, the problem lies in request structure rather than pure capacity insufficiency.

    3.4 Cache Layer: Confirm Whether Buffering Capacity Has Failed

    Check cache hit rate, cache capacity, eviction speed, expiration ratio, and hot key distribution. When hit rate drops significantly, determine whether the cause is insufficient capacity, unreasonable key design, or a change in traffic patterns.

    Cache key design directly determines hit rate. The following example includes all parameters that affect output in the key while excluding irrelevant fields such as session ID and timestamp:

    1. cache_key = hash(
    2. model_id,
    3. model_version,
    4. prompt_template_version,
    5. normalize(prompt), # trim leading/trailing whitespace, normalize full-width/half-width characters, unify line breaks
    6. temperature,
    7. top_p,
    8. max_output_tokens
    9. )

    If the cache key contains a session ID or timestamp, requests with the same content cannot hit the cache. Conversely, if temperature or template version is missing, requests with different requirements may incorrectly receive the same result.

    Semantic caching (hitting by vector similarity) can improve hit rate, but it carries clear risks. When the similarity threshold is set too low, requests such as “delete order” and “cancel order” that are semantically close but have different meanings may be misjudged as the same request. Sharing semantic caches across tenants can also lead to data leakage. For sensitive businesses, caches should be isolated by tenant, and the semantic-hit similarity threshold should be raised to, for example, 0.97, combined with sampled manual review.

    Prefix caching for long contexts also has a cost boundary. Cached intermediate states occupy VRAM, so a maximum cache length and time to live (TTL) should be set. For example, cache only the first 16k tokens, set TTL to 10 minutes, and do not cache beyond that.

    3.5 Dependency Layer: Confirm Whether External Components Are Dragging Down the Main Path

    Perform health checks on dependencies such as authentication, configuration, message queues, logging, and storage, focusing on call latency, error rate, timeout rate, and retry count. When dependencies are abnormal, execute a predefined degradation checklist instead of making ad hoc decisions.

    Set a timeout budget for each dependency. Suppose the total timeout of the main path is 30 seconds. It can be allocated as follows: authentication no more than 100 ms; configuration read no more than 50 ms, using local cached configuration if the read fails; log writes use asynchronous sending and do not consume main-path time; inference calls use the remaining budget. Retries also need budget constraints: a single call is retried at most once, and full-link retry traffic does not exceed 10% of original traffic.

    The mapping between the degradation checklist and dependencies is as follows:

    • Authentication service timeout: enable local token validation and record logs for later review.
    • Configuration center unavailable: use local snapshot configuration and raise an alert.
    • Logging service blocked: switch to asynchronous writes, and drop low-priority logs when the queue is full.
    • Object storage abnormal: pause non-core file output features and retain text generation.
    • Message queue backlog: pause submission of batch asynchronous tasks and prioritize online requests.

    4. Stability Engineering: From Firefighting to Proactive Defense

    4.1 Establish Layered Rate Limiting and Quota Mechanisms

    The purpose of rate limiting is to protect the system from being overwhelmed by excessive traffic, not to reject as many requests as possible. It is recommended to set quotas across four dimensions: tenant, interface, model, and request cost. The following is an example of admission control code. All thresholds are example values:

    1. def admit(request, tenant, model):
    2. cost = estimate_cost(
    3. input_tokens=request.input_tokens,
    4. max_output_tokens=request.max_output_tokens,
    5. cache_hit_ratio=request.cache_hit_ratio,
    6. )
    7. quota = QUOTA[tenant][model] # per-minute token quota
    8. if not quota.consume(cost):
    9. return Reject(status=429, retry_after=5)
    10. if queue_length(model) > QUEUE_LIMIT[model]: # for example, more than 200 requests queued
    11. return Reject(status=503, retry_after=5)
    12. if cost > HIGH_COST_THRESHOLD: # requests above the cost threshold enter the low-priority queue
    13. return Admit(lane="low_priority")
    14. return Admit(lane="normal")

    Quotas can be managed centrally with a configuration file:

    1. tenants:
    2. tenant_a:
    3. models:
    4. large-model:
    5. tpm_limit: 300000 # per-minute token limit, example value
    6. max_concurrency: 20 # maximum number of requests processed concurrently
    7. queue_limit: 200 # queue limit
    8. small-model:
    9. tpm_limit: 1000000
    10. max_concurrency: 60
    11. queue_limit: 500

    Clients need to cooperate with rate limiting. After receiving 429 or 503, use exponential backoff retries. A recommended base interval is 1 second, with a cap of 16 seconds, random jitter, and at most 3 retries. The server-returned Retry-After should take precedence over the client’s own calculated wait time. Immediate retries without backoff turn rate limiting into a retry storm and multiply traffic.

    Rate limiting also carries a risk of false positives. If quotas or queue thresholds are set too low, normal business traffic will be rejected in large volumes. Before launch, observe the rejection rate on canary traffic. If a tenant’s rejection rate during normal hours exceeds 1%, that tenant’s quota should be re-evaluated.

    4.2 Improve Circuit Breaking, Degradation, and Fallback Strategies

    The purpose of circuit breaking is to fail fast when dependencies or inference resources are abnormal, preventing requests from piling up. A circuit breaker needs clear parameter definitions:

    • Statistical window: 10 seconds.
    • Minimum request count: do not make a judgment when there are fewer than 20 requests in the window, to avoid false triggers under low traffic.
    • Error rate threshold: trigger circuit breaking when the error rate in the window exceeds 50%. Errors include timeouts and 5xx, but not 4xx client errors.
    • Slow-call threshold: also trigger circuit breaking when calls whose latency exceeds the target value (for example, 2 times the historical P95) account for more than 60%.
    • Cooldown time: reject new requests for 30 seconds after circuit breaking.
    • Half-open probing: after the cooldown ends, allow at most 3 probe requests. If all succeed, close the circuit breaker; if any fails, return to the circuit-breaker state and double the cooldown time, up to a maximum of 120 seconds.

    Degradation should be executed step by step according to priority, from light to heavy:

    1. Return cached results.
    2. Switch to a backup small model and indicate in the response that quality may be reduced.
    3. Shorten the maximum output token count.
    4. Convert to an asynchronous task and return a task ID.
    5. Reject new non-core requests.

    Rollback conditions for degradation are as follows: recover step by step only after the error rate returns below the threshold and remains there for two statistical windows; if the user complaint rate or manual sampling failure rate of the backup model exceeds the set value, immediately roll back to the previous level.

    Both circuit breaking and degradation carry risks of false positives. If circuit breaking is too aggressive, many healthy instances will be removed, and the remaining instances will be overwhelmed, creating an avalanche. A minimum available instance ratio should be maintained, for example, at least 30% of instances stay online. When output quality drops after degradation, users should be informed in the response so they do not mistakenly believe the result is fully correct.

    4.3 Improve the Stability of Cache Design

    The cache layer should be continuously optimized across four aspects: capacity, hit rate, key design, and invalidation policy. High-frequency repeated requests should be cached first. Session-based requests should have controlled cache lifecycles to avoid无效 data accumulation. The trend of hit rate is more informative than a single point-in-time value. If hit rate continues to decline, it should be treated as an early warning signal of capacity or traffic structure changes, and you should return to the cache-layer troubleshooting steps above.

    4.4 Strengthen Elastic Scaling and Resource Isolation

    LLM services should reserve sufficient elastic space to handle burst traffic. Scaling includes not only compute resources but also VRAM, network bandwidth, storage, and queue capacity.

    Scaling trigger conditions can be set as follows: P95 queue waiting time exceeds 2 seconds and lasts for 3 minutes, or GPU utilization exceeds 80% and lasts for 5 minutes. There should be a 10-minute cooldown between two scaling actions to avoid frequent scaling caused by metric jitter. Scaling should also have a cost cap, for example, controlled by a daily budget. After the budget is exhausted, scale only to the minimum replica count and raise an alert at the same time.

    In multi-tenant scenarios, resource isolation should be implemented using separate resource pools, separate queues, and separate rate-limit thresholds. For core businesses, set higher priority and stricter guarantees. When isolation fails or resources are still insufficient, the degradation order is as follows: first pause queues for low-priority tenants, then shorten output length, and finally rate-limit overall traffic.

    4.5 Establish Observability and Alerting Systems

    Without observability, there is no stability. The following metric list adds collection location, aggregation window, and alert severity so it can be implemented directly:

    Metric Collection location Aggregation window Alert severity
    P99 latency, timeout rate Gateway 1 minute Warning: exceeds 1.5× baseline for 5 minutes; Critical: exceeds 2× baseline for 3 minutes
    Inference queue length Inference scheduler 15 seconds Warning: exceeds 70% of queue limit; Critical: exceeds limit
    GPU utilization, VRAM usage Node monitoring probe 30 seconds Warning: utilization exceeds 85% for 5 minutes
    Cache hit rate Cache service 5 minutes Warning: down 20% from the 7-day average for the same period
    Dependency call latency, retry rate Caller SDK 1 minute Warning: retry rate exceeds 10% of original traffic
    Circuit-break count Gateway 1 minute Critical: the same dependency breaks more than 3 times within 1 minute
    Release and configuration changes Release system Event record Informational, used for post-hoc correlation

    Alerts should not focus on a single metric only; they should be judged in combination with correlations. The following rules can serve as a starting point:

    • Error rate rises and queue grows: prioritize as a capacity problem.
    • Latency rises, resource utilization is normal, and dependency latency rises: prioritize as a dependency problem.
    • Cache hit rate drops within 30 minutes after a release: prioritize as cache invalidation caused by the change.

    5. Post-Incident Review: Turn One Incident into Long-Term Capability

    After a service incident occurs, the review should not stop at restoring service. It should produce actionable improvement items. The review should focus on whether the incident was detected in time, whether localization was accurate, whether stop-loss was effective, whether capacity evaluation was distorted, and whether there were gaps in the change process.

    It is recommended to establish the following mechanisms:

    1. Create a timeline for every incident, recording the time spent in discovery, localization, stop-loss, and recovery.
    2. Review key metrics to confirm whether there were early warning signals before the incident.
    3. Correct the capacity model to include changes in request complexity and cache hit rate.
    4. Conduct drills to validate rate limiting, circuit breaking, and degradation strategies, and confirm that parameters are effective under real traffic.
    5. Convert review conclusions into monitoring items, runbooks, or automation policies, and assign owners and completion times.

    6. Conclusion: A Three-Step Rollout

    Stability engineering can be advanced in the following order:

    1. Build observability first. Complete collection of the key metrics described above, set alert severities, and configure correlation rules so that capacity problems and dependency problems can be distinguished.
    2. Then implement rate limiting and degradation. Configure tenant quotas, circuit-breaker parameters, and degradation priorities, and validate their effectiveness in load tests.
    3. Finally, conduct reviews and drills. Correct the capacity model after each incident, and regularly drill degradation paths so that stability capabilities continue to improve.