Files
ianitor/bench/README.md
T

84 lines
5.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Benchmarks and conformance (ROADMAP §5 layers 2 and 5)
Data, not marketing: every run's raw output is committed here, and this page summarises it, including where Caddy
wins.
| Folder | What | Made by |
| :-- | :-- | :-- |
| `results/<date>-<label>.csv` and `results/<date>-<label>/` | load and soak runs: one CSV row per engine, scenario and concurrency; oha's raw JSON; `machine.txt` | `scripts/bench.sh <label>` |
| `conformance/` | h2spec and testssl.sh outputs for Ianitor and for Caddy | `scripts/conformance.sh` |
## How the runs are made
`tests/diff/src/bin/pair.rs` (`ianitor-pair`) compiles one route, `localhost` → a small upstream that answers
`200 ok`, for both engines with Ianitor's compilers, and starts Ianitor's edge (in its own process with the
upstream in a child) and two Caddys: one as Go starts it (every core) and one with `GOMAXPROCS=2`. Edge runs Pingora
with **two worker threads** (`crates/edge/src/lib.rs`), a deliberate budget for a home server, so the second Caddy
is the like-for-like comparison and the first shows what Caddy does with the whole machine.
[oha](https://github.com/hatoo/oha) then drives each engine in turn, the same way:
| Scenario | What it measures |
| :-- | :-- |
| `https-h1-keepalive`, 1/16/64/256 connections | HTTP/1.1 over TLS, connections reused: the proxy path itself |
| `https-h2`, 1/16/64/256 connections | the same over HTTP/2 |
| `https-h1-new-conn`, 16 connections | a new TLS handshake per request |
| `http-redirect`, 64 connections | the plain-HTTP listener's 308 (no upstream) |
| `soak-https-h1`, 32 connections, 5 minutes | latency and errors over time, memory after (`rss_kb_after`) |
Caveats that apply to every number: the load generator, both proxies and the upstream share one machine and its
cores; loopback has no network latency, so small differences in CPU per request dominate; the upstream is trivial.
Compare rows of one file with each other, not numbers across machines. `machine.txt` records the CPU, the kernel,
whether it is WSL2, the build (release or debug) and the tool versions.
## Results
### Load and soak: 2026-11-18, WSL2 Ubuntu 26.04 (`results/2026-11-18-wsl2-ubuntu.csv`)
AMD Ryzen 7 5800X3D (16 threads), 32 GB, WSL2 kernel 6.18; release build; Caddy v2.11.7 built with Go 1.26.8 from
its official module (no Nix on this machine: Caddy reports its version as "unknown"); oha 1.17; 15 s a run, one run
each. Requests per second (higher is better), and p99 latency in ms:
| Scenario | Ianitor (2 threads) | Caddy (all cores) | Caddy (GOMAXPROCS=2) |
| :-- | --: | --: | --: |
| HTTP/1.1, keep-alive, 1 conn | 1,861 / 9.0 | 1,757 / 2.5 | **2,351** / 0.8 |
| HTTP/2, 1 conn | **2,173** / 0.8 | 1,375 / 1.4 | 1,588 / 1.4 |
| HTTP/1.1, 16 conns | 3,843 / 28.8 | 6,905 / 45.5 | **7,759** / 11.2 |
| HTTP/2, 16 conns | 4,723 / 27.5 | **6,090** / 35.6 | 3,426 / 28.6 |
| HTTP/1.1, 64 conns | 6,596 / 50.9 | **15,653** / 31.3 | 6,561 / 39.8 |
| HTTP/2, 64 conns | **11,726** / 23.2 | 8,472 / 59.6 | 5,708 / 37.3 |
| HTTP/1.1, 256 conns | 4,421 / 155.6 | **12,632** / 101.9 | 4,473 / 147.0 |
| HTTP/2, 256 conns | 3,981 / 146.6 | **10,077** / 101.9 | 3,607 / 134.4 |
| New TLS connection per request, 16 | 1,218 / 50.6 | **2,236** / 65.0 | 1,823 / 21.4 |
| Plain-HTTP redirect, 64 | 13,582 / 32.4 | **54,027** / 16.3 | 17,027 / 15.5 |
| Soak, HTTP/1.1, 32 conns, 5 min | 6,245 / 31.3 | **13,031** / 35.4 | (not run) |
Every request of every run succeeded (success rate 1.0, no unexpected status). Memory (resident, after each run, the
process that serves the port): Ianitor 13 MB at the start, 56 MB after the soak; Caddy 60 MB and 77 MB.
**Where Caddy wins:** almost everywhere with the whole machine, by about 2× under HTTP/1.1 load and 4× on the
plain-HTTP redirect; with the same two cores it is still ahead on HTTP/1.1 at 1 to 16 connections, on new TLS
connections (about 1.5×, so rustls handshakes cost Ianitor more than Go's) and on the redirect.
**Where Ianitor wins:** HTTP/2 at 1 and 64 connections (ahead of both Caddys), HTTP/2 at 16 and 256 connections
against Caddy on two cores, and memory, which stays below Caddy's in every run. At 64 and 256 HTTP/1.1 connections
Ianitor and Caddy on two cores are even.
How much to read into it: one run each, on a desktop that was doing other things; a 2-second smoke run of the same
script just before gave Ianitor 14,341 requests/s on HTTP/1.1 with 16 connections, against 3,843 here, so single
numbers move a lot on this machine. The ordering at 64 connections and above, the redirect and the handshake cost
were the same in both runs. For a home server, every row is far beyond what it will see; the numbers are here to
keep the comparison honest, not to choose an engine.
### Conformance: 2026-11-18, same machine (`conformance/`)
| | h2spec (145 cases) | testssl.sh 3.2.2 |
| :-- | :-- | :-- |
| Ianitor | 144 passed, 1 skipped, **0 failed** | A+; TLS 1.2 and 1.3; no server cipher order (rustls follows the client) |
| Caddy 2.11.7 | 140 passed, 1 skipped, **4 failed** | A+; TLS 1.2 and 1.3; server cipher order; session tickets valid 7 days (LOW) |
Caddy's four h2spec failures (Go's HTTP/2 server): HEADERS larger than SETTINGS_MAX_FRAME_SIZE (4.2/3), several
SETTINGS_INITIAL_WINDOW_SIZE values (6.5.3/1), a connection-specific header field and a `TE` other than
`trailers` (8.1.2.2/1 and 2). The two HIGH findings testssl.sh reports for both engines belong to the throwaway test
certificate (a validity of about 2,100 years, no CRL or OCSP URL), not to the engines; HSTS and security headers
are the routes' business (header rules), not set on the test route.