Benchmarks¶
The newest run is first. The earlier runs stay below with their dates, because they measured other things: a container, a chain with an API key and a cache, enforcement under load, a store outage. None of them is from reference hardware; those figures are still to come.
2026-11-11: Linux, the current build¶
One desktop PC (AMD Ryzen 9 7900X, 12 cores, 24 threads) running Linux under WSL 2 (kernel
5.15). The gateway in file mode (apinx gateway run), its demo backend in the same process and
the load generator (hey) all ran on that machine and shared its cores. The access log was on
and written to a file. Each cell is 15 seconds of load; every answer was a 200.
| Route | 50 connections | 200 connections | 800 connections |
|---|---|---|---|
| Plain route to the backend | 41,352 req/s, p50 0.8 ms, p99 4.5 ms | 78,560 req/s, p50 1.6 ms, p99 11.1 ms | 76,581 req/s, p50 7.7 ms, p99 43.3 ms |
| Typical chain | 35,642 req/s, p50 1.0 ms, p99 4.8 ms | 73,987 req/s, p50 1.7 ms, p99 12.3 ms | 68,958 req/s, p50 8.7 ms, p99 46.0 ms |
| Mocked route, answered by the gateway | 115,968 req/s, p50 0.3 ms, p99 2.2 ms | 150,917 req/s, p50 0.8 ms, p99 7.4 ms | 140,225 req/s, p50 1.9 ms, p99 30.2 ms |
| The backend alone, no gateway | 146,996 req/s, p50 0.8 ms, p99 6.8 ms |
The typical chain is forward, rate-limit, transform and normalize-errors. At 50
connections the load, not the gateway, sets the figure: each connection waits for its answer
before it sends the next request.
With the gateway held to a number of CPU cores (GOMAXPROCS), its demo backend inside the same
cores and the load generator on the others:
| Cores | Connections | Plain route | Typical chain | Mocked route |
|---|---|---|---|---|
| 4 | 200 | 40,819 req/s, p50 4.5 ms, p99 12.0 ms | 38,366 req/s | 95,371 req/s |
| 2 | 100 | 26,753 req/s, p50 3.5 ms, p99 8.4 ms | 23,843 req/s | 59,768 req/s |
Memory (resident): 33 MiB at idle, 75 MiB after six million requests at up to 200 connections, 100 MiB after nine million at up to 800.
What these figures are not. The load generator and the backend took a share of the same processor, so a gateway with a machine to itself does more; WSL 2 is a virtual machine; the backend answers a few bytes from memory, which no real service does. Read them as what one ordinary machine did, not as a limit.
On Windows 11 on the same machine, the same day: 52,900 req/s on the plain route, 50,900 on the chain and 129,400 on the mocked route at 200 connections. Run side by side at 50 connections, this build served 48,600 to 50,500 req/s on the plain route where release 1.1.4 served 45,000. Windows is for trying Apinx; production is Linux.
To repeat it, with a gateway file that has the three routes:
apinx gateway run gateway.yaml # or: GOMAXPROCS=2 apinx gateway run gateway.yaml
hey -z 15s -c 200 http://127.0.0.1:8080/plain/echo
2026-09-25: the release test run¶
On a development laptop; the full report is docs/TEST-RUN-2026-09-25.md in the repository.
Linux, Docker image¶
apinx:dev in a container, the load generator (hey) in a second container on the same
Docker network, access log to stdout enabled, backend on loopback.
| Connections | Requests/s | p50 | p90 | p99 | Result |
|---|---|---|---|---|---|
| 50 | 46,170 | 0.8 ms | 2.2 ms | 5.1 ms | 923,460 × 200, 0 errors |
| 200 | 41,820 | 3.6 ms | 10.2 ms | 20.1 ms | 836,724 × 200, 0 errors |
Container memory after the runs: 193 MiB.
Full policy chain¶
Seven policies (API key, threat protection, CORS, rate limit, request and response transforms, cache) on a cached response, Windows laptop with the client sharing the CPU:
| Run | Requests/s | p50 | p99 | Result |
|---|---|---|---|---|
| 50 connections, 30 s | 17,950 | 2.7 ms | 3.8 ms | 538,544 × 200, 0 errors |
| 200 connections, 20 s | 18,830 | 10.4 ms | 13.8 ms | 200 until the 600,000/min API limit, then 429 |
The seven policies cost nothing measurable over a bare route on the same machine.
Enforcement under load¶
| Limit | Observed |
|---|---|
| 300 per minute | 298 × 200 among 541,528 requests (two calls were spent by curl in the same minute) |
| 6,000 per minute | exactly 6,000 × 200, then 429 |
| 600,000 per minute | 599,999 × 200 across two runs, then 429 |
Telemetry dropped nothing over 2.3 million requests.
Store outage¶
With PostgreSQL stopped: 373,768 × 200 at 18,700 requests/s over 20 s; cache misses still reached the backend; quotas kept counting in memory; recovery without a restart.
Per-request cost¶
2026-10-24, Go benchmarks in the repository, measured through a loopback backend so the figures include Go's own HTTP server and client, not only the gateway's work (ADR-0034):
- A typical chain (api-key, rate-limit, transform, normalize-errors) went from 260 to 238 allocations and from 38.3 KB to 30.9 KB per request.
- A route lookup across 2,000 routes went from 188 ns and 3 allocations to 157 ns and 2.
About half of what remains is Go's HTTP stack and the reverse proxy's request clone.
2026-11-06, the same benchmarks after the wave of security, performance and memory work (ADR-0053 to ADR-0059):
- A SOAP answer published as JSON went from 1,409 allocations and 90 KB per request to 286 and 28 KB (the decoder walks the XML once and writes JSON as it goes).
- A request with three service callouts went from 998 allocations to 911, and from 755 to 649 when their answers are cached; the request to each callout is built from its definition rather than cloned from the caller's.
- The analytics flush every ten seconds is one merge statement per batch instead of a read and a write per series: 1,250 series into PostgreSQL in 40 ms instead of 1.2 s.
- A Cloud organization without a request for ten minutes holds no connection and runs no health check until its next request.
Memory and throughput by mode¶
2026-10-24, development laptop, Windows 11, the demo backend in the same process, hey with 50
concurrent callers for 20 seconds per route (one million requests each), working set read from
the process:
| Mode | Idle | Settled after 3M requests | Plain route | Typical chain | Mocked route |
|---|---|---|---|---|---|
File (apinx gateway run) |
21 MiB | 83 MiB | 57k req/s | 57k req/s, p50 0.8 ms, p99 2.5 ms | 123k req/s |
| Console (store, console, analytics) | 39 MiB | 133 MiB | 54k req/s | 54k req/s | 119k req/s |
The typical chain is forward, rate-limit, transform and normalize-errors. The console
mode figure includes the access log, the request inspector, the analytics ingester and SQLite.
The same measurement found a defect that is now fixed: the upstream pool kept 32 idle
connections per target, so with more concurrent callers than that the gateway closed and
re-dialled about a thousand backend connections a second. The default
max_idle_conns_per_target is now 256; under the same load no new connection is opened once
the pool is warm, and the chain route went from 42k to 57k req/s in file mode.
How to reproduce¶
go install github.com/rakyll/hey@latest
hey -z 30s -c 50 -H "X-API-Key: apk_…" http://localhost:8080/your-api/path
For the Linux figures, build the image with docker build -f deploy/Dockerfile -t apinx:dev .
and run hey from a container on the same network.