Building NovAI: one key for 116 models incl. Zhipu Flash free tier. I write about API economics - what a finished task costs, not what a token costs. Price by billing unit: aiapi-pro.com
Zero errors is the right headline and the least interesting number: a correct swap should produce zero errors. What actually moves is the handshake. ML-KEM makes the initial flight larger and adds CPU per full handshake, so the metrics worth watching are p99 TLS handshake time and the resumption ratio - not error rate.
Split those two populations before concluding the swap was free: long-lived clients mostly resume and will barely show it, while cold connections pay the full cost and show it in the tail first. Your part 1 and 2 already separate cost per handshake from cost per request, which is the distinction most write-ups skip.
Fair point, and thanks for reading parts 1 and 2 closely. Zero errors is the floor, not the finding: I led with it because “does the swap drop traffic?” was the question I got from a reader, but you’re right that the handshake is where the cost moves.
One clarification on what was measured: every request in this run was a cold full handshake (session cache and tickets off, new connection each time), so it’s entirely the population you describe as showing it first. In that population, handshake p99 went from ~0.85 ms to ~0.97 ms at 500 conn/s (same AZ, 3 trials each), and ML-KEM cost +68 µs CPU per full handshake. That’s the same +19% the post reports, offset by OpenSSL 3.5 being cheaper than 3.0.
On resumption, one nuance: TLS 1.3 resumption in the mode browsers and OpenSSL actually use (psk_dhe_ke) still does a fresh key exchange, so resumed handshakes pay the ML-KEM cost too. What they skip is the certificate and the signature. My guess is that ML-KEM’s relative overhead is higher on resumed handshakes, not lower. I haven’t measured that split yet, and my next trial would be, cold vs resumed, with handshake p99 and resumption ratio tracked separately.
hi 于侃,
I ran the split. Same three arms, session tickets on, with the client resuming 0%, 50% or 90% of connections, 3 trials each at 2,000 conn/s:
ML-KEM costs +68 µs CPU per handshake whether cold or resumed. Resumption doesn’t avoid it: every resumed handshake on the PQ arm still negotiated X25519MLKEM768 (psk_dhe_ke), confirmed in nginx’s log. Relative overhead is +17% cold vs +20% resumed, because resumption skips the cert and signature but not the key exchange.
You were right about the tail. Going from OpenSSL 3.0 to 3.5+PQ lowers CPU per cold handshake (493 → 466 µs) but raises handshake p99 (1.13 → 1.29 ms). On the same 3.5 build, PQ adds ~0.33 ms to cold p99 and ~0.24 ms to resumed p99.
So “the swap was free” holds for CPU, not latency. And long-lived clients don’t escape it by resuming: they pay the same +68 µs, it’s just a bigger slice of a cheaper handshake.
Building NovAI: one key for 116 models incl. Zhipu Flash free tier. I write about API economics - what a finished task costs, not what a token costs. Price by billing unit: aiapi-pro.com
Those numbers reframe it well: CPU down ~27 us per cold handshake but p99 up ~160 us means you did not remove the cost, you moved it from CPU to the tail. That is a much better trade than it reads as, because CPU was the scarce resource during the swap.
The number I would watch at fleet scale is the resumed-handshake one. +68 us per resumed handshake sounds free per request, but resumption is the common path, so at 10k resumed handshakes/s across a pool that is ~0.68 core-seconds of added service time every second - a capacity question rather than a latency one, and it shows up first as queueing on the busiest nginx, not as a higher p99 anywhere obvious.
Did you measure a resumption ratio alongside the p99s? Without it, the +68 us is hard to compare across traffic mixes.
hi 于侃,
Yes, measured both sides: the client recorded per request whether it actually resumed, and nginx logged $ssl_session_reused. They agree at 0.0 / 0.50 / 0.90 for the three mixes. The useful part is that the ML-KEM delta doesn’t depend on the mix: fitting cold and resumed cost separately gives +68 µs for each. So across traffic mixes the added CPU is just 68 µs × handshakes/s, whatever the ratio. Your 10k/s → ~0.68 core figure is exactly the right way to size it.
One refinement on “moved from CPU to the tail”: those are two changes stacked. The OpenSSL 3.0 → 3.5 upgrade alone lowered CPU and p99 (cold: 493 → 398 µs, 1.13 → 0.97 ms). Adding ML-KEM on top raised both again (+68 µs, +0.33 ms p99). So the upgrade bought headroom, and PQ spent part of it in CPU and more than all of it in tail latency. If you’re stuck on a distro OpenSSL 3.0, the net looks like a trade; on a fleet already on 3.5, it’s a pure cost.
Agree it shows up as queueing first. In the CPU ladder, at ~87–89% CPU the median handshake rose from ~0.8 ms to ~1.25 ms before anything else looked wrong. At fleet scale I’d alert on handshakes/s per node (split by $ssl_session_reused) against that node’s measured ceiling, not on p99 alone. Keep-alive makes request rate a poor proxy, since handshake rate is what costs.
Building NovAI: one key for 116 models incl. Zhipu Flash free tier. I write about API economics - what a finished task costs, not what a token costs. Price by billing unit: aiapi-pro.com
Your reframe splits the change into two moves with opposite signs: from your numbers CPU per cold handshake goes 493 → 466 µs (-5.5%) while cold p99 goes 1.13 → 1.29 ms (+14%). So the upgrade buys capacity and PQ spends tail. A fleet that was CPU-capped gains room; a fleet that was tail-capped loses.
Which is why I would alert on the knee rather than a fixed percentage of CPU: find the handshakes/s per vCPU where p99 crosses your SLA, before and after PQ, and alert at a fraction of that measured knee. On your ladder it moves below 87-89%, so a static threshold fires after the fact - the exact failure you are describing.
One more field worth logging per node: the $ssl_session_reused ratio, because it changes what the knee means as much as load does.
We're a place where coders share, stay up-to-date and grow their careers.
Zero errors is the right headline and the least interesting number: a correct swap should produce zero errors. What actually moves is the handshake. ML-KEM makes the initial flight larger and adds CPU per full handshake, so the metrics worth watching are p99 TLS handshake time and the resumption ratio - not error rate.
Split those two populations before concluding the swap was free: long-lived clients mostly resume and will barely show it, while cold connections pay the full cost and show it in the tail first. Your part 1 and 2 already separate cost per handshake from cost per request, which is the distinction most write-ups skip.
Fair point, and thanks for reading parts 1 and 2 closely. Zero errors is the floor, not the finding: I led with it because “does the swap drop traffic?” was the question I got from a reader, but you’re right that the handshake is where the cost moves.
One clarification on what was measured: every request in this run was a cold full handshake (session cache and tickets off, new connection each time), so it’s entirely the population you describe as showing it first. In that population, handshake p99 went from ~0.85 ms to ~0.97 ms at 500 conn/s (same AZ, 3 trials each), and ML-KEM cost +68 µs CPU per full handshake. That’s the same +19% the post reports, offset by OpenSSL 3.5 being cheaper than 3.0.
On resumption, one nuance: TLS 1.3 resumption in the mode browsers and OpenSSL actually use (psk_dhe_ke) still does a fresh key exchange, so resumed handshakes pay the ML-KEM cost too. What they skip is the certificate and the signature. My guess is that ML-KEM’s relative overhead is higher on resumed handshakes, not lower. I haven’t measured that split yet, and my next trial would be, cold vs resumed, with handshake p99 and resumption ratio tracked separately.
hi 于侃,
I ran the split. Same three arms, session tickets on, with the client resuming 0%, 50% or 90% of connections, 3 trials each at 2,000 conn/s:
ML-KEM costs +68 µs CPU per handshake whether cold or resumed. Resumption doesn’t avoid it: every resumed handshake on the PQ arm still negotiated X25519MLKEM768 (psk_dhe_ke), confirmed in nginx’s log. Relative overhead is +17% cold vs +20% resumed, because resumption skips the cert and signature but not the key exchange.
You were right about the tail. Going from OpenSSL 3.0 to 3.5+PQ lowers CPU per cold handshake (493 → 466 µs) but raises handshake p99 (1.13 → 1.29 ms). On the same 3.5 build, PQ adds ~0.33 ms to cold p99 and ~0.24 ms to resumed p99.
So “the swap was free” holds for CPU, not latency. And long-lived clients don’t escape it by resuming: they pay the same +68 µs, it’s just a bigger slice of a cheaper handshake.
Data and scripts: pqc-bench-nginx-swap, results/7b/.
Those numbers reframe it well: CPU down ~27 us per cold handshake but p99 up ~160 us means you did not remove the cost, you moved it from CPU to the tail. That is a much better trade than it reads as, because CPU was the scarce resource during the swap.
The number I would watch at fleet scale is the resumed-handshake one. +68 us per resumed handshake sounds free per request, but resumption is the common path, so at 10k resumed handshakes/s across a pool that is ~0.68 core-seconds of added service time every second - a capacity question rather than a latency one, and it shows up first as queueing on the busiest nginx, not as a higher p99 anywhere obvious.
Did you measure a resumption ratio alongside the p99s? Without it, the +68 us is hard to compare across traffic mixes.
hi 于侃,
Yes, measured both sides: the client recorded per request whether it actually resumed, and nginx logged $ssl_session_reused. They agree at 0.0 / 0.50 / 0.90 for the three mixes. The useful part is that the ML-KEM delta doesn’t depend on the mix: fitting cold and resumed cost separately gives +68 µs for each. So across traffic mixes the added CPU is just 68 µs × handshakes/s, whatever the ratio. Your 10k/s → ~0.68 core figure is exactly the right way to size it.
One refinement on “moved from CPU to the tail”: those are two changes stacked. The OpenSSL 3.0 → 3.5 upgrade alone lowered CPU and p99 (cold: 493 → 398 µs, 1.13 → 0.97 ms). Adding ML-KEM on top raised both again (+68 µs, +0.33 ms p99). So the upgrade bought headroom, and PQ spent part of it in CPU and more than all of it in tail latency. If you’re stuck on a distro OpenSSL 3.0, the net looks like a trade; on a fleet already on 3.5, it’s a pure cost.
Agree it shows up as queueing first. In the CPU ladder, at ~87–89% CPU the median handshake rose from ~0.8 ms to ~1.25 ms before anything else looked wrong. At fleet scale I’d alert on handshakes/s per node (split by $ssl_session_reused) against that node’s measured ceiling, not on p99 alone. Keep-alive makes request rate a poor proxy, since handshake rate is what costs.
Your reframe splits the change into two moves with opposite signs: from your numbers CPU per cold handshake goes 493 → 466 µs (-5.5%) while cold p99 goes 1.13 → 1.29 ms (+14%). So the upgrade buys capacity and PQ spends tail. A fleet that was CPU-capped gains room; a fleet that was tail-capped loses.
Which is why I would alert on the knee rather than a fixed percentage of CPU: find the handshakes/s per vCPU where p99 crosses your SLA, before and after PQ, and alert at a fraction of that measured knee. On your ladder it moves below 87-89%, so a static threshold fires after the fact - the exact failure you are describing.
One more field worth logging per node: the $ssl_session_reused ratio, because it changes what the knee means as much as load does.