Skip to main content

Performance results

All numbers are from the fresh runs of 2026-08-24 (commit 08851ee), WAF containers constrained to 2 vCPU / 4 GiB. Full methodology, raw tables, and reproduction steps: BENCHMARK.md in the repository root. Treat cross-engine ratios as the signal — absolute values shift with hardware.

Parser micro-throughput​

Standalone parser, single thread, median of 15 passes, idle host:

BodyMedianThroughput
92 B< 1 µs—
100 KiB0.38 ms260 MiB/s
1 MiB3.7 ms271 MiB/s
10 MiB37.8 ms265 MiB/s
20 MiB75.7 ms264 MiB/s
Parser throughput by body size (single thread, median of 15 passes)
  • 100 KiB260 MiB/s
  • 1 MiB271 MiB/s
  • 10 MiB265 MiB/s
  • 20 MiB264 MiB/s
Same values as the table above (BENCHMARK.md, section 1). The 92 B row has no throughput figure and is not charted.

Throughput is flat in body size; memory is flat too — the parser state is a 16,600-byte control block regardless of the document (40 KiB extra only when duplicate-key rejection is enabled).

What the guard adds per request​

Guard + ModSecurity + full CRS, 4 workers, 175/175 correct outcomes. "Guard p50" is the module's self-reported inspection time ($json_guard_inspection_us):

CaseGuard p50Total p50Share
Small JSON object (~100 B)0.01 ms46.8 ms< 0.1%
1 MiB clean JSON4.1 ms77.3 ms5.3%
20 MiB clean JSON96.3 ms2920 ms3.3%
20 MiB, SQLi at tail (403 by CRS)82.9 ms2031 ms4.1%
Guard inspection time, p50 (module timer, not end-to-end)
  • Small JSON object (~100 B)0.01 ms
  • 1 MiB clean JSON4.1 ms
  • 20 MiB clean JSON96.3 ms
  • 20 MiB, SQLi at tail82.9 ms
The Guard p50 column above, from $json_guard_inspection_us. The 0.01 ms small-body value was measured before the per-request double zeroing of the parser was removed (BENCHMARK.md, section 2); re-run make waf-perf for a current figure.

On an accepted 20 MiB body under full CRS, the guard's timer reports 75.2 ms median — 0.67% of the ModSecurity-only latency for the same body. The tail-SQLi row is the point of the module: CRS still inspects the entire document and blocks the attack at the far end.

Engine throughput (processor suites)​

32-request corpus dominated by 1–100 MiB JSON bodies, 4 workers, no CRS. Latencies are client-observed end-to-end HTTP times (upload, proxy and upstream included), not parser time:

EngineMiB/sPeak RAMp50 / p95
nginx-baseline127.2368 MiB639 / 3678 ms
nginx-guard167.2363 MiB414 / 2579 ms
nginx-modsecurity-processor74.81654 MiB593 / 6526 ms
nginx-guard-modsecurity-processor105.81150 MiB519 / 3400 ms
coraza-processor55.72148 MiB822 / 7894 ms
Large-body throughput by engine (4 workers, no CRS)
  • Baseline (no JSON processing)127.2 MiB/s
  • JSON Guard167.2 MiB/s
  • ModSecurity processor74.8 MiB/s
  • Guard + ModSecurity processor105.8 MiB/s
  • Coraza processor55.7 MiB/s
MiB/s column of the table above (BENCHMARK.md, section 3). Coraza runs behind Caddy; the other engines run in NGINX.

The guard-only bar sits above baseline because this corpus contains malformed and over-limit bodies that the guard rejects early — baseline must proxy every byte. On a fully well-formed corpus the guard lands at or slightly below baseline. The same early-rejection effect explains guard+ModSecurity beating ModSecurity alone (105.8 vs 74.8 MiB/s).

Early rejection economics​

20 MiB bodies, median latency by outcome:

CaseOutcomeLatency
Clean, accepted (full CRS scan)2002920 ms
Malformed tail400 by guard313 ms
Token/cardinality over limit413 by guard241 ms (guard portion 3.5 ms)
SQLi at tail403 by CRS2031 ms
20 MiB body: client-observed latency by outcome (median)
  • Clean, accepted (200, full CRS scan)2,920 ms
  • SQLi at tail (403 by CRS)2,031 ms
  • Malformed tail (400 by guard)313 ms
  • Over limit (413 by guard)241 ms
Guard + ModSecurity + full CRS, 4 workers. Blue: the guard rejected the body before rules ran. Orange: the body was accepted by the guard and CRS processed it.

The structural rejects are roughly 10x cheaper than a full CRS scan — that is the budget the guard spends on every accepted body (about 3–5%) and saves on every rejected one.

Reproduce​

make test # 75 parser unit tests
make bench-micro # micro-throughput table above (~1 min, idle host)
make cross-waf-full # 8 engine profiles (~90 min + image build)
make waf-correctness # 21-case constrained run (~5 min)
make waf-perf # 175-request mixed run (~10 min)

Reports and per-request JSON land under artifacts/. The runs quoted here: artifacts/cross-waf/20260824-004254/ and artifacts/waf-perf/20260824-021348/ and artifacts/waf-perf/20260824-021836/ (local run output, gitignored and not committed to the repository; the published tables in BENCHMARK.md are the reference).