Time to first token peak hours is a recurring pain point for production LLM applications. The latency you benchmark at 3 a.m. rarely holds at noon, and the gap is not random jitter—it is the predictable result of queueing, batching, and rate limits colliding. If you ship a chatbot without modeling this, your p95 TTFT will surprise you exactly when traffic matters most.
The anatomy of time to first token
What TTFT actually measures
TTFT is the wall-clock duration from sending the final request byte to receiving the first streaming token. It includes connection setup, request parsing, scheduler admission, model forward pass for the prompt, and the first decode step. It deliberately excludes generation of subsequent tokens.
In an OpenAI-compatible streaming call, you capture it client-side:
import time, openai
client = openai.OpenAI(base_url="https://api.example.com/v1", api_key="sk-...")
start = time.perf_counter()
stream = client.chat.completions.create(
model="mistral-7b",
messages=[{"role": "user", "content": "Explain queueing"}],
stream=True,
)
for chunk in stream:
if chunk.choices[0].delta.content:
break
ttft = time.perf_counter() - start
print(f"TTFT: {ttft*1000:.1f} ms")
This prints the user-perceived delay. Server-side traces may differ by 10–30 ms due to network egress, but the shape is identical.
Where the milliseconds go
At low load, a 7B model on a single A100 might return first token in 30–80 ms. That budget covers ~10 ms network, ~5 ms scheduling, ~20–40 ms prompt processing. Under peak load, the same request can take 2–5 seconds. The silicon did not slow down; the request waited in a queue.
Why peak hours change the equation
Queueing theory in plain terms
Model the GPU as a single-server queue with variable service time. Requests arrive as a Poisson process; service time depends on prompt length. Little’s law states L = λW: the average number of in-system requests equals arrival rate times average wait. As λ approaches service capacity μ, W grows without bound.
Time to first token peak hours maps directly onto this curve. When your traffic pattern pushes utilization from 60% to 95%, average wait increases not by 1.5× but by an order of magnitude. The nonlinearity is the entire story.
Batching and the fairness tax
Inference servers like vLLM or TensorRT-LLM use continuous batching. They pack many sequences into one forward pass to maximize token throughput. This raises tokens-per-second per dollar but adds latency for individual requests because your prompt may wait for the current batch to fill or for running decodes to step.
{
"scheduler": "continuous_batching",
"max_batch_size": 32,
"waiting_requests": 17,
"running_requests": 32
}
If 32 sequences are already decoding, your request sits in waiting_requests until one finishes. That wait is pure TTFT penalty. Chunked prefill mitigates this by slicing long prompts, but each chunk still competes for scheduling slots.
KV cache pressure and context reuse
The KV cache holds attention state for active sequences. Under peak load, cache blocks fragment. The scheduler may preempt low-priority contexts, forcing recomputation. Even with prefix caching, a cache miss on a long system prompt costs extra prompt-processing time exactly when the machine is busiest. A 2K-token system prompt that hits cache at 4 a.m. might miss at noon because the cache was evicted to make room for other tenants.
Provider rate limits and the thundering herd
Autoscaling lag
GPU node groups autoscale, but attaching a new A100 takes minutes—image pull, CUDA init, model load. Traffic peaks form in seconds. During that lag, existing nodes absorb excess, driving utilization past the knee of the queueing curve. Your TTFT spike lags the traffic spike by the scale-up delay.
The fallback illusion
When a primary provider returns 429s, clients retry or switch. A gateway such as n4n.ai implements automatic fallback when a provider is rate-limited or degraded, and it honors client routing directives; this can smooth TTFT spikes by shedding load to a secondary provider. But the secondary faces the same queueing math. Fallback distributes pain; it does not create free GPU cycles.
Client-side patterns that amplify the spike
Retry storms
A naive client sees an 800 ms TTFT and assumes timeout, firing a duplicate request. Now the server has two requests to process, deepening the queue. Implement jitter and passive health checks before retrying.
Synchronous fan-out
Orchestrating ten parallel LLM calls per user action multiplies arrival rate λ by ten. If each call hits the same model pool, you’ve manufactured your own peak. Batch logically or accept higher TTFT.
Measuring it yourself
Don’t trust vendor dashboards alone. Instrument TTFT from your own edge. Log per-request timestamps and tag by hour:
curl -s -N -X POST https://api.example.com/v1/chat/completions \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{"model":"mixtral-8x7b","messages":[{"role":"user","content":"hi"}],"stream":true}' \
| head -c 200
Wrap with a timestamping tool to record first byte. Aggregate p50/p95 by hour-of-day. You will see the time to first token peak hours pattern as a daily wave correlated with user timezones. A simple Python aggregation:
import pandas as pd
df = pd.read_csv("ttft.csv", parse_dates=["ts"])
df["hour"] = df["ts"].dt.hour
print(df.groupby("hour")["ttft_ms"].quantile(0.95))
Tradeoffs: latency vs throughput vs cost
Over-provisioning
Keep GPUs idle to cap utilization at 60%. TTFT stays flat through peaks. Your cloud bill triples. For consumer-scale apps, that margin kills unit economics.
Smaller batches
Limiting max_batch_size to 8 reduces wait but cuts throughput per GPU. You need more replicas for same QPS. Again, cost.
Prewarming and routing
Send predictable traffic to reserved pools. Use cache-control hints to let providers reuse prefixes. Some gateways, including n4n.ai, forward provider cache-control hints so a cached prefix survives routing decisions; this shaves prompt compute during peaks. Only works if your prompts share prefixes.
Speculative decoding
Draft models can reduce decode latency but do little for TTFT because the first token still requires full prompt processing. Don’t mistake it for a peak-hour fix.
Capacity modeling for engineers
Little’s law applied
Estimate steady-state wait: if you serve 100 req/s on hardware that sustains 120 req/s of prompt processing, utilization ρ = 0.83. Expected queue delay ≈ (ρ/(1-ρ)) * service_time. At ρ=0.83, that’s ~5× service time. At ρ=0.95, ~19×. Plot this before choosing headroom.
Setting headroom
Target ρ ≤ 0.7 during predicted peaks. If your peak QPS doubles, either prewarm double capacity or shed load. There is no third option that preserves TTFT.
A decisive takeaway
Time to first token peak hours is not a mystery; it is queueing delay amplified by batching and rate limits. Measure it per hour, set batch size and autoscaling headroom based on your p95 target, and use fallback only as a shock absorber—not a latency cure. Engineer for the noon curve, not the 3 a.m. line.