Inference-Aware Load Balancing for LLMs (part 11): streams, timeouts and SLOs, measured

Every idle timer on the path of a streamed LLM answer, set on camera at NGINX and the BIG-IP; what an SLO for an LLM measures; goodput at 2, 4 and 8 clients; and what Prometheus histograms can and cannot tell you.
Hand-drawn: 504 at 60.01 s with NGINX defaults, and goodput from 50% to 2% as clients go from 2 to 8

On this page

A model server that stays silent for 75 seconds before its first token: through NGINX's defaults, 504 at 60.01 s; through a BIG-IP with a 30 s idle timer, reset at 31.32 s. Then a service level for an LLM, two latencies at once, and goodput at 2, 4 and 8 clients: 50.5%, 32.0% and 2.0%. And what Prometheus cannot tell you about the same requests. This is part 11 of Inference-Aware Load Balancing for LLMs, configured on camera. It goes with a video on the LevelUP I.T. YouTube channel.

Goodput against load
Goodput against load

A stream is a long silence

A streamed answer is one long response: silent until the first token (a long prompt's prefill, a queue, a cold replica), then a token every few milliseconds. This series has measured those silences: 9.8 s first tokens from a cold replica (part 9), 48 s for the 24B model's cold start (part 6). Every hop holds the connection and has an idle timer, and the shortest one wins, as an error that looks like an outage. To show it, a generated simulator that is silent for exactly 75 s (--latency-calculator constant --time-to-first-token 75s) on its own route, slow.f5lab.test, straight to its Service, so only the timeouts are on trial. A new tool, slo.py one, sends one request and reports how it ended and after how long.

The gateway's timeout

NGINX waits at most proxy_read_timeout between two reads from the upstream; the default is 60 s. The slow route has no policy; the one proxy_read_timeout 300s in the configuration belongs to the llm route (part 3).

slo one http://llm-gw-nginx.llm lfm2.5-1.2b-slow --host slow.f5lab.test
HTTP 504 after 60.01 s: <html><head><title>504 Gateway Time-out</title>

apiVersion: gateway.nginx.org/v1alpha1
kind: ProxySettingsPolicy
metadata: {name: slow-streams, namespace: llm}
spec:
  targetRefs: [{group: gateway.networking.k8s.io, kind: HTTPRoute, name: slow}]
  timeout: {read: 300s, send: 300s}

HTTP 200 after 75.03 s (first token at 75.01 s)

The BIG-IP's idle timer

Part 10's virtual server in front of the same gateway, with a generated iRule:

ltm rule /Common/llm-idle {
when CLIENT_ACCEPTED { IP::idle_timeout 30 }
when SERVER_CONNECTED { IP::idle_timeout 30 }
}
pc1:  ConnectionResetError after 31.32 s: [Errno 104] Connection reset by peer
(the same rule at 600)
pc1:  HTTP 200 after 75.02 s (first token at 75.02 s)

The BIG-IP sweeps idle connections periodically, so the cut lands a little after 30 s. The TCP profile's own idle timeout (300 s here) does the same job without an iRule. The rule for the whole path: BIG-IP idle timeout > gateway read timeout > the longest silence a stream can have.

This post is for paying subscribers only

Subscribe to LevelUp I.T. newsletter and stay updated.

Don't miss anything. Get all the latest posts delivered straight to your inbox. It's free!
Great! Check your inbox and click the link to confirm your subscription.
Error! Please enter a valid email address!