Skip to main content

Gateway overhead

This page gives the time that the Verdictan gateway adds to a request. The numbers come from the benchmark in the bench/ directory of the Verdictan CLI source. You can run the same benchmark on your hardware.

What the benchmark measures​

The benchmark measures overhead. Overhead is the time that the gateway adds between your application and the model provider.

The benchmark does not use a real model provider. A mock provider on the same computer sends each response after a fixed time. The difference includes gateway work and local scheduling variation. It excludes network delay to a remote control plane.

Method​

The benchmark does these steps for each policy chain:

  1. It starts a mock OpenAI-compatible provider. The provider sends a response after 20 ms. A streamed response starts after 20 ms and has 16 chunks, 5 ms apart.
  2. It starts a mock Verdictan control plane. The mock control plane answers token validation, usage authorization, and event delivery immediately.
  3. It starts verdictan gateway run and waits until /readyz shows that the gateway is ready.
  4. It sends each set of requests directly to the mock provider. This result is the baseline.
  5. It sends the same requests through the gateway.
  6. It calculates the overhead as the gateway percentile minus the baseline percentile.

The benchmark uses these fixed settings:

SettingValue
Warm-up requests in each run25
Measured requests in each run250
Concurrency1, 10, and 50 requests at the same time
Request bodyA system message and a user message of approximately 1 KiB
Payload seed20261023
CacheEach prompt is different, so the cache does not answer a request

Each scenario has three accepted runs. The reported value is the median of the three run values. The one-minute load must stay below 16 at the recorded start and end of each scenario. The comparison excludes any run with failed requests or incomplete samples.

The benchmark uses three policy chains:

ChainPolicies
No policiesNone. The gateway authenticates, routes, and records events.
Starter chainprompt-injection and pii-detector, with default settings
Finance chainThe finance starter template: seven policies. The benchmark removes its Valkey rate limits.

Results​

These results measure build b35050794 on Linux with an AMD Ryzen 9 7950X3D and 32 logical CPUs. The same executable runs on two local XFS filesystems with the same durability settings. The original disk is a Samsung SSD 990 PRO 4TB. The faster disk is a KIOXIA-EXCERIA PLUS G3 SSD. These results describe the tested configurations. They do not compare these products under all workloads.

The mock provider and control plane run on the same computer. Each value is the median of three accepted runs. Overhead values are in milliseconds. Throughput counts completed requests each second and excludes the final event-drain wait. Overhead percentile values can decrease because each value subtracts results from separate request sets.

ChainModeConcurrencyOriginal disk p50 / p95 / p99Original disk requests/sFaster disk p50 / p95 / p99Faster disk requests/s
No policiesnon-stream130.1 / 36.4 / 39.119.517.5 / 21.5 / 24.025.9
No policiesnon-stream1087.3 / 109.0 / 130.890.871.3 / 87.6 / 97.7106.0
No policiesnon-stream50335.3 / 415.8 / 457.5136.1338.4 / 398.8 / 423.7134.3
No policiesstream130.3 / 36.1 / 47.17.818.6 / 20.8 / 21.98.6
No policiesstream1073.7 / 88.6 / 89.557.972.6 / 87.5 / 88.858.8
No policiesstream50313.3 / 340.2 / 373.3118.4303.6 / 367.1 / 375.4119.8
Starternon-stream134.0 / 42.7 / 47.718.020.1 / 25.4 / 27.424.2
Starternon-stream10108.4 / 134.1 / 148.676.799.6 / 133.6 / 150.180.1
Starternon-stream50455.1 / 559.1 / 627.999.1457.8 / 573.0 / 634.599.5
Starterstream133.5 / 44.0 / 48.97.621.5 / 24.6 / 26.08.4
Starterstream10102.5 / 125.9 / 128.950.496.4 / 115.4 / 132.152.6
Starterstream50452.4 / 528.1 / 551.087.8434.9 / 466.1 / 463.793.6
Financenon-stream161.0 / 87.2 / 189.011.628.0 / 32.2 / 35.520.5
Financenon-stream10161.3 / 193.3 / 214.254.2151.0 / 186.8 / 197.656.9
Financenon-stream50722.0 / 890.3 / 1058.965.0721.2 / 896.2 / 1073.065.9
Financestream148.0 / 63.1 / 77.56.825.4 / 29.6 / 34.78.2
Financestream10126.8 / 154.8 / 173.543.9112.2 / 147.9 / 159.047.0
Financestream50606.3 / 702.8 / 738.968.6635.6 / 705.5 / 705.967.5

Time to first byte​

Time to first byte (TTFB) measures when the client receives the first response bytes. These values show TTFB overhead with one request at a time.

ChainOriginal disk TTFB p50 / p95 / p99 (ms)Faster disk TTFB p50 / p95 / p99 (ms)
No policies13.8 / 16.8 / 21.29.4 / 12.2 / 13.6
Starter93.7 / 98.6 / 103.389.4 / 92.8 / 95.0
Finance100.2 / 106.0 / 113.692.9 / 97.0 / 99.3

The starter chain checks response PII before it exposes output to the client. This check requires the complete response. The finance chain also checks response content for MNPI, financial compliance, and quality. The gateway buffers output when these checks require it. A chain without response checks can send chunks as they arrive.

The full comparison records all three runs, their load readings, and the before/after measurements. See the benchmark results.

Limits of these results​

  • Shared test computer. Accepted scenarios have recorded one-minute load below 16 at both endpoints. This does not guarantee an idle computer.
  • Control-plane time. The benchmark records about 12 calls per request, including background event delivery. Admission calls add network delay in remote deployments.
  • Provider time. The benchmark uses a fixed mock provider. These results do not predict latency with a real model provider.
  • Optional models. The benchmark does not install the optional local models. Policies that use them can take more time.
  • Disk. Requests wait for durable audit writes. Faster storage reduces this wait, but serialization and policy checks still limit throughput.
  • Durability. Both configurations use the same sync boundaries. The comparison does not test hardware behavior during power loss.

Run the benchmark​

Run the benchmark from a checkout of the Verdictan CLI source:

make -C cli bench VERDICTAN_BIN=/path/to/verdictan

The command writes bench/RESULTS.md and bench/results.json. The results include the commit, the gateway version and checksum, the Node.js version, the CPU, the memory, and the system load. If other workloads load the computer during the run, RESULTS.md shows a warning.

To do a short test of the setup, add BENCH_ARGS=--quick. If ports 8840 to 8842 are in use, set BENCH_PORT_BASE to a different first port.

To compare storage, select an existing directory on another durable filesystem:

make -C cli bench VERDICTAN_BIN=/path/to/verdictan \
  BENCH_ARGS="--out /path/to/run-1 --state-root /path/on/durable/storage"

Keep the executable and other settings the same. Repeat each configuration three times with separate output directories. The harness removes only its own temporary gateway directory.