LLM Long-Running Inference Disconnects: A Timeout Chain Governance Guide

    Long-running LLM inference can fail when a request is cut off after tens of seconds, even though the model is still generating. This article explains how TTFT and token throughput determine total inference time, where read, idle, and server-side timeouts appear across the request chain, and why an HTTP 503 or connection reset alone cannot identify the source. It then shows how to measure TTFT, stable throughput, and total connection duration before optimizing, using fixed versus scattered disconnect times to distinguish timeout thresholds from load or network jitter. The article also introduces governance approaches, beginning with prioritization.

    In practice, a request may be sent and the model may continue reasoning for tens of seconds, but the connection is cut at a fixed point and the client receives an error such as HTTP 503 or a connection reset. The first instinct is often to blame an unstable service or a slow model. After investigation, however, the model is often still generating normally, and the interruption has occurred at some intermediate point along the request path.

    LLM inference can be divided into two stages. The first is Time To First Token (TTFT), the time from sending the request to receiving the first output token. It is mainly determined by queuing, prompt preprocessing, and context loading. The second stage is token-by-token generation, whose throughput is usually measured in tokens per second (TPS). Total latency can be approximated as:

    Total latency ≈ TTFT + output tokens ÷ TPS

    Suppose a task outputs 20,000 tokens and throughput is 50 tokens per second. The generation stage takes about 400 seconds. If throughput drops to 25 tokens per second, the same output requires 800 seconds. When throughput is halved, duration doubles. For tasks such as code generation, long-document analysis, and derivation of complex test cases, several minutes of inference time is normal. The request chain must therefore be able to support such long-lived connections.

    2. Where Timeouts Can Occur

    A request usually passes through multiple layers: the client program, a local proxy or gateway, an access-layer load balancer, service routing, and the inference service itself. Each layer may set timeouts. Three types are common.

    The first is the read timeout. While waiting for response data, the client disconnects if it receives no bytes within a configured period. Many HTTP clients have relatively short default read timeouts, and those defaults may not be tuned for long-running inference.

    The second is the idle timeout. Reverse proxies, load balancers, and gateways usually monitor whether data is flowing on the connection. Many components have default idle thresholds around sixty seconds. Non-streaming requests are especially likely to trigger this limit because the server sends nothing until the entire response has been generated, so the connection appears silent to the proxy.

    The third is the server-side request deadline. The inference service may set a maximum execution time for a single request, or it may reject requests that have waited too long in the queue under high load. These limits usually return status codes such as 503, 504, or 429. The status code alone is not enough to locate the problem. The same 503 may come from an upstream timeout mapped by a proxy or from server overload. It must be interpreted together with timing, logs, and request body size.

    3. Measure Metrics Before Optimizing

    Measure before optimizing. The following illustrative code records the TTFT and throughput of a streaming request. Here, stream_chat returns an iterator of incremental chunks from the server, and each chunk approximately corresponds to one token.

    1. start = now()
    2. first_at = None
    3. pieces = 0
    4. for piece in stream_chat(prompt):
    5. if first_at is None:
    6. first_at = now()
    7. pieces += 1
    8. end = now()
    9. ttft = first_at - start
    10. tps = pieces / (end - first_at)
    11. report(ttft, tps, end - start)

    The number of chunks is not exactly the same as the token count. If the server returns a usage statistics field in the response, use that field to calculate throughput.

    When measuring, record three sets of data: TTFT, stable throughput, and the total time from sending the request to disconnection. If disconnect times consistently fall around a fixed value, a timeout threshold is almost certainly responsible. If disconnect times are scattered, server load or network jitter is more likely.

    4. Governance Approaches

    1. Prioritization