A gateway that holds state per call, or that waits on something while the provider is slow, would show it here. Its own share would grow as the provider's latency grows. This run tests that with pacod-benchmark. The mock provider answered after 20, 200 and 1,000 ms, and each latency was run through pacod-gw in managed mode and in proxy mode. Each cell is measured against a baseline of the same calls made straight to the mock.
The run
The suite is the example "Gateway overhead by provider latency". Its base configuration:
- Requests: OpenAI-style requests with streaming on: 60 words of prompt, at most 64 tokens of answer.
- Mock: an OpenAI mock that streams 20 chunks, 20 ms apart, after its head.
- Load: 20 callers in a closed loop for a minute, after a 5-second warm-up.
The suite varies two axes:
axes:
request.mode: [managed, proxy]
mock.delay_ms: [20, 200, 1000]
Two modes at three latencies make six cells, and the three latencies make three baselines: nine cells in all.
The run was made on 10 November on a pacod-gw test installation: gateway commit 7054b67, one instance, Valkey as its cache store. All 13,379 calls succeeded.
The figures
The latencies are the whole call, from request to the last chunk, over the minute of steady load. "Gateway" is pacod-gw's own delay before the response head, which it reports on every response.
| Mock delay | Cell | Calls/s | p50 | p95 | p99 | Gateway p50 / p99 |
|---|---|---|---|---|---|---|
| 20 ms | baseline | 36.0 | 545 ms | 651 ms | 815 ms | – |
| 20 ms | managed | 34.8 | 545 ms | 725 ms | 831 ms | 0.083 / 0.139 ms |
| 20 ms | proxy | 34.4 | 545 ms | 717 ms | 1.09 s | 0.077 / 0.137 ms |
| 200 ms | baseline | 26.7 | 725 ms | 905 ms | 1.03 s | – |
| 200 ms | managed | 26.7 | 725 ms | 864 ms | 1.17 s | 0.088 / 0.153 ms |
| 200 ms | proxy | 26.2 | 725 ms | 922 ms | 1.03 s | 0.076 / 0.141 ms |
| 1,000 ms | baseline | 12.4 | 1.55 s | 1.86 s | 2.28 s | – |
| 1,000 ms | managed | 12.7 | 1.53 s | 1.65 s | 1.71 s | 0.087 / 0.149 ms |
| 1,000 ms | proxy | 13.0 | 1.53 s | 1.68 s | 1.76 s | 0.077 / 0.135 ms |
The answer is no. The gateway's own median stayed between 0.076 and 0.088 ms, and its 99th percentile between 0.135 and 0.153 ms. The mock's latency made no difference: a provider fifty times slower cost the gateway the same fraction of a millisecond. Proxy mode, which forwards the request without the managed checks, was about 0.01 ms faster at the median than managed mode at every latency.
The whole calls agree. At each latency, the medians of both cells are the baseline's, within one step of the histograms the figures are read from: 8 ms between half a second and a second, 16 ms above.
What the table also shows
The arithmetic of a closed loop. Each call should take the mock's delay plus 20 chunks of 20 ms: 420, 600 and 1,400 ms. The baselines took 545, 725 and 1,548 ms, about 125 to 150 ms more, and the cells took the same. That extra time is spent before the gateway is involved: in the load agent, the mock and the machine they share. Twenty callers divided by those times give the calls per second in the table: 36, 27 and 13.
The tails are the machine's. The p99 column moves by hundreds of milliseconds in both directions:
- The 20 ms proxy cell's p99 was 274 ms above its baseline's.
- The 1,000 ms managed cell's p99 was 565 ms below its baseline's.
The gateway's own p99 meanwhile moved by less than 0.02 ms. The per-second series show where these tails come from: the whole machine paused now and then, in baselines and cells alike. In the 200 ms managed cell, for instance, no call completed in its fourth second, and the next second's median was 1.74 s. A pause like that lands in whichever cell is running. One run's tail says nothing about the gateway.
Behaviour, not capacity
The run says so at the top of its page, with its reasons:
agent local ran on the gateway's machine; the mock is shared with other load (the tester's load tests)
This is the distinction the first benchmark post explains. The run shows how the gateway behaves: its own delay does not grow with the provider's. It cannot show how much the gateway can carry, because the agent and the mock competed with the gateway for the same machine. Capacity figures take load agents on other machines and a mock of the target's own.
Try it
The suite is one of pacod-benchmark's examples. Run it from the live demo, or next to your own pacod-gw:
cargo run -p pacod-bench -- run --suite examples/suites/latency.yaml --target target.toml \
--agents local=http://127.0.0.1:18096 --out report.json
The report is in pacod-gw's own format, pacod-bench-report/1, and the gateway's console accepts it under Platform → Testing → Benchmarks. The code is in the repository.