There's a lot of discussion going on about post-quantum TLS. Both AWS and Cloudflare claim the overhead is minimal — but both are vendor-published, on infrastructure most people don't have. This is the starting post of a different attempt: an independent, reproducible benchmark of X25519MLKEM768 (the NIST-standardized hybrid PQ key exchange, FIPS 203) versus classical X25519. I ran it on two c7g.large EC2 instances in the same AWS zone. The full run cost less than a dollar.
Complete setup — Terraform, Gatling simulation, driver script, raw Gatling result files — is in the repo. This can be reproduced in around ~50 minutes for under $0.30 (based on my experience, accounting for the occasional disruption during a test).
Setup
| Piece | Choice |
|---|---|
| Target | c7g.large spot, Ubuntu 24.04, nginx built from source against OpenSSL 3.5.0 |
| Load generator | c7g.large spot, JDK 21, Gatling 3.15.1 (Java DSL) |
| Placement | Same subnet, same AZ (us-east-1) — cross-AZ latency would swamp the effect |
| Protocol | TLS 1.3 only |
| Cipher suites | TLS_AES_256_GCM_SHA384, TLS_CHACHA20_POLY1305_SHA256 |
| Server cert | Self-signed ECDSA P-256 |
| KEM (A/B knob) | X25519 vs X25519MLKEM768 |
| Response body | 3 bytes ("OK\n") — the point is handshake, not transfer |
| Session resumption | Disabled (fresh handshakes only) |
| Trials | 3 per arm, 5 min each, 30 s warmup dropped |
Note on the self-signed cert
The server serves an ECDSA cert, not an ML-DSA-65 one.
The reason: Gatling uses Netty's BoringSSL under the hood, and BoringSSL doesn't advertise ML-DSA-65 in its supported signature algorithms. If nginx only had an ML-DSA-65 cert to serve, BoringSSL wouldn't be able to complete the handshake at all.
This actually mirrors real-world PQ TLS in 2026: no public CA issues ML-DSA-65 certs. Everyone shipping "PQ TLS" today serves a classical cert with a hybrid KEM. This benchmark measures the KEM overhead under exactly that pattern.
First attempt: what didn't work
My first serious run was at 1000 req/s. The numbers were absurd:
| Metric | Classical | PQ |
|---|---|---|
| min | 1 ms | 1 ms |
| mean | 1,318 ms | 1,230 ms |
| p99 | 6,440 ms | 6,091 ms |
| max | 7,648 ms | 7,548 ms |
Not "PQ is faster than classical" — that's not physically possible when the PQ arm does the same work as classical plus more crypto. The shape (min=1ms, mean=1300ms) is the fingerprint of client-side CPU saturation. 1000 fresh handshakes/sec on a 2-vCPU loadgen means each vCPU is doing 500 handshakes/sec of X25519 or ML-KEM math — beyond a c7g.large's capacity. Requests queue for CPU, means shoot into the seconds range, and any actual PQ vs classical delta gets swallowed by queuing noise.
Cross-check: PQ p99 across the 3 trials ranged 5892 → 6091 → 7623 ms. That trial-to-trial variance is bigger than any real signal I could measure — a red flag on its own.
Lesson: benchmark your load generator before you trust its numbers. Client-side CPU cost is easy to forget when the discussion is all about server overhead.
The real numbers, at 300 req/s
Dropping to 300 req/s puts the loadgen well inside its capacity envelope. Now I'm measuring the handshake itself.
Median of 3 trials, latency in milliseconds:
| Metric | Classical (X25519) | PQ (X25519MLKEM768) | Overhead |
|---|---|---|---|
| min | 1 | 1 | — |
| mean | 2 | 2 | — |
| p50 | 1 | 2 | +1 ms |
| p95 | 4 | 4 | — |
| p99 | 5 | 8 | +3 ms (+60%) |
| max | 14 | 41 | +27 ms |
Trial-by-trial p99 (to show the variance honestly):
| Trial | Classical p99 | PQ p99 |
|---|---|---|
| 1 | 4 | 5 |
| 2 | 5 | 8 |
| 3 | 5 | 39 |
Trial 3's PQ p99 of 39 ms is a real outlier — likely a spot instance CPU steal event or a JVM GC pause, though I haven't isolated the cause yet. Something to nail down in Phase 2 with more trials.
What this tells me
Three findings worth stating:
1. In the common case, PQ overhead is essentially invisible. At 300 req/s on Graviton3, X25519MLKEM768 costs the same 2 ms mean handshake as classical X25519. p50 and p95 are the same at ms-resolution. If your SLO is "handshake under 50 ms", PQ vs classical is not what you should be worrying about.
2. The cost shows up in the tail. Median p99 grew from 5 ms to 8 ms. In one of three trials the PQ p99 was 39 ms — 8x what the median trial saw. This matches what I expected theoretically: KEM operations have more variance than raw X25519, and worst-case scheduling amplifies the difference.
3. This is a floor, not a ceiling. At sub-10 ms latencies, Gatling's integer-millisecond quantization hides sub-ms differences. The "no difference" reading at mean/p50/p95 may be masking real ~0.5 ms deltas. Higher-precision timing and higher throughput on beefier instances would tell more.
What I can't say from this run
- How PQ overhead scales with concurrent connection count. All measurement here is at a fixed rate with the loadgen sized carefully to avoid saturation.
- What happens with session resumption. Session resumption skips the KEM entirely. Real traffic is a mix — measuring just the fresh case is the worst case.
- Whether Graviton3's specific silicon helps or hurts PQ. Would need x86 (c7i.large) or AMD (c6a.large) runs for comparison.
- Anything about payload size scaling. Every response was 3 bytes.
All of these are Phase 2 targets.
Reproduce it
git clone https://github.com/asifmahbubnaeem/pqc-bench
cd pqc-bench
# Configure AWS profile + AMI IDs in terraform/bench/terraform.tfvars
make bench-up
make wait-ready
./scenarios/01-fresh-handshake-latency/run.sh 300 3
make bench-down
Wall time: ~50 min. AWS cost: ~$0.15. The raw Gatling result trees, including per-trial HTML reports and simulation.log files, can be found in results/2026-09-27-scenario-01-rate300/.
What's next
Phase 2 questions:
- Payload sweep: 100 B / 1 KB / 100 KB / 1 MB response. Does handshake overhead disappear into transfer time?
- Session resumption: Full mix, 0-RTT, 1-RTT. What's the effective overhead when 90% of connections resume?
- Cross-architecture: Same benchmark on c7g (Graviton3, ARM), c7i (Intel Sapphire Rapids), c6a (AMD EPYC). Does the KEM math favor any one microarchitecture?
- Concurrency sweep: 100 / 500 / 2000 concurrent connections at fixed rate — where does saturation actually hit, and does the answer differ for PQ vs classical?
I'll post those over the coming weekends. If there's a specific angle you'd want measured, contact me.
Data, methodology and all scripts live in the repo. Corrections and independent reruns very welcome — that's the whole point.
Draft assistance from Claude; all measurements, interpretations, and the setup work are mine and independently verified against the raw data in the repo.
Top comments (7)
Benchmarking post-quantum TLS cost on a $0.04/hour Graviton3 is a smart way to ground an abstract migration decision in a real number instead of a vendor claim
What's the per-handshake cost delta you're seeing between classical and post-quantum so far?
Hi,
Thanks — "ground an abstract migration decision in a real number instead of a vendor claim" is exactly the framing I wanted.
Here's the per-handshake p-table from the Phase 1 fresh-handshake arm at 300 rps on c7g.large (TLS 1.3, hybrid X25519MLKEM768 + ML-DSA-65 cert):
percentile classical (X25519) hybrid PQ delta
p50 1 ms 2 ms +1 ms
p95 4 ms 4 ms 0 ms
p99 5 ms 8 ms +3 ms
So the median handshake adds ~1 ms, p95 is indistinguishable, and the tail (p99) takes the biggest hit at +60%.
One caveat worth flagging though: that's a fresh TCP + TLS per request, which almost no production traffic actually looks like. Part 2 (published this week) measures what happens once connections pool and session resumption is on — PQ overhead at p95 drops to ~1 ms on fresh and 0 ms on resumed. Once the handshake amortizes, the record layer is AES-GCM in both cases.
Any particular workload shape you'd want to see benchmarked next?
A p99 tail that takes a 60 percent hit while p50 and p95 barely move is the kind of result that only shows up once you measure percentiles separately instead of an average, that's a much more honest number than most PQC benchmarks report
Once connection pooling kicks in for Part 2, does that tail gap shrink because the handshake cost gets amortized, or does it show up again somewhere else like CPU on the resumed session
hi Vlad Z,
Great question — exactly what Part 2 was designed to answer. Short version: the tail gap collapses to near-zero when the handshake amortizes, and doesn’t resurface on the resumed sessions.
Phase 2 scenario 02 (fresh vs resumed × classical vs PQ, 300 rps on c7g.large):
arm p95 p99
classical-fresh 4 ms ~11 ms
pq-fresh 5 ms ~6 ms
classical-resumed 1 ms 1 ms
pq-resumed 1 ms 1 ms
p99 is noisy with only 3 trials, so the Phase 2 fresh p99 actually came out lower for PQ than classical. That’s variance, not a real effect. The Phase 1 ordering (classical p99 < PQ p99) is directionally correct; what matters here is the fresh-to-resumed collapse.
Why it doesn’t shift to CPU on the resumed session: PQ’s extra cost lives in the KEM key exchange — bigger ClientHello/ServerHello messages, more sign/verify work. Resumption uses PSK-based keying and skips the KEM entirely. After that, every record is wrapped in AES-256-GCM — same code path for both arms, no PQ-specific CPU in the hot loop. Part 3’s 1 MB-payload rerun confirms this independently: 60k requests per trial at 20 users/sec, classical and PQ statistically identical at p99.
So the Phase 1 p99 hit is real but it’s a per-fresh-connection cost. For connection-pooled traffic (= most production HTTPS), it amortizes over the pool’s lifetime and doesn’t resurface.
Owning up to p99 being noisy with only 3 trials instead of reporting it as a clean win is the right call, that's the difference between a benchmark that holds up and one that just looks clean in a writeup
If you're getting close to actually putting PQC on a real production TLS stack rather than benchmarking it in isolation, we can talk
Thanks Vlad Z, appreciate the call-out specifically. Doing just enough trials to detect the tail was noisy, and flagging it rather than smoothing it, felt right but also felt like leaving a tidier number on the table.
I tried getting SLH-DSA onto nginx against the WAN setup & found TLS layer is not shipping yet in OpenSSL 3.5.2 or OQS-provider 0.12. SLH-DSA has the crypto and X.509 layers, but no TLS integration - Posted as part 4 of the series.
What stack are you planning around - openssl fronend (nginx/Envoy), rustls or something else? is it the signature side or KEM you are most concerned about?
Happy to talk more on this, open for any suggestion. Email in profile.
Nginx/Envoy on the openssl frontend is the more realistic adoption path for most shops over the next couple years, rustls is cleaner but the migration cost of swapping the whole stack is a harder sell than swapping a TLS library underneath something already deployed
KEM is the side I'd worry about first, a compromised signature just means re-issuing certs, a broken KEM means everything encrypted under it going back is retroactively exposed
Good find on the OQS-provider gap, that's exactly the kind of thing that turns a clean migration plan into a multi-quarter one once you hit it in practice