← Back to section · Research & Analysis

Experiment Design: How to Measure Hybrid TLS Handshake Size and Latency

Putting X25519MLKEM768 next to plain X25519 in the same handshake looks simple, yet many measurements go wrong. A reproducible design: which variables to lock, how to compute the size, how to measure latency, and how to read the results.

Published 22 November 2026 · 5 min read · PQ Frontier

Experiment Design: How to Measure Hybrid TLS Handshake Size and Latency
AI-generated site artwork
Video explainer · Experimental Research: Reproducible Designs

The research question: narrow it first

“How much does hybrid key exchange slow TLS down” is a bad question, because it kneads three different questions into one lump: how much bigger the handshake messages get, how much extra CPU time the local computation costs, and how many extra round trips appear on a real network. These three have different causes, different magnitudes and different remedies; measured together, the resulting number is neither reproducible nor actionable.

This experiment splits the question into three independently answerable sub-questions. First, with X25519MLKEM768 enabled, how many bytes do the key_share fields of ClientHello and ServerHello grow by, and does anything cross a critical threshold — one TCP initial congestion window, say, or one QUIC datagram? Second, on identical hardware, how much more CPU time do encapsulation and decapsulation cost compared with plain X25519? Third, on a link with a given loss rate and round-trip time, does the larger handshake produce observable extra round trips or retransmissions? Each sub-question gets its own measurement set, and no data is borrowed across sets.

The size bill: compute first, then measure

Most of the size analysis is arithmetic and does not need to wait for an experiment. Per the FIPS 203 parameter table, an ML-KEM-768 encapsulation key is 1184 bytes and a ciphertext is 1088 bytes; an X25519 public key and shared point are 32 bytes each. In hybrid mode the client sends the concatenation of its X25519 public key and the ML-KEM encapsulation key in key_share, and the server replies with the concatenation of its X25519 public key and the ML-KEM ciphertext. It follows that the ClientHello grows by roughly 1184 bytes over plain X25519, and the server’s first flight by roughly 1088 bytes. These are the experiment’s expected values; the measurement’s job is to check whether a concrete implementation’s encoding inflates beyond them — redundant extensions, duplicated supported_groups entries, or an unintentionally enlarged certificate chain.

The measurement itself is deliberately plain: export the byte count of every handshake message with a packet capture or the TLS library’s debug callbacks, and log per message type rather than as a single handshake total. Per-message logging is what makes deviations localisable: if the total overshoots, you can see immediately which message is bloated. Record TLS record-layer fragmentation separately — a logical message split across several records is record-layer behaviour and must not be charged to the key exchange.

Latency: separate network from computation

Latency is measured in two groups. The first isolates pure computation: run handshakes over the loopback interface of a single machine, where network round trips are approximately zero, so the measured time difference comes mainly from the key-exchange arithmetic itself. ML-KEM’s NTT operations and X25519’s scalar multiplication live in different leagues, but both are small in absolute terms; only thousands of repetitions, reported as medians and percentiles, can fish the difference out of the noise. Report the median and the 95th percentile, never a single minimum — a minimum measures luck, not performance.

The second group measures a real link: inject a fixed round-trip time and loss rate in a controlled link emulator (say 50 ms RTT and one percent loss) and observe whether the larger ServerHello triggers extra round trips or retransmissions. The critical variable here is the server’s initial congestion window, which must be written into the experiment record: the same byte growth can yield opposite conclusions under an initial window of 10 MSS versus 30 MSS.

One check is easily missed: the authenticity of the negotiation result. Before the experiment starts, confirm from server logs or packet captures that the two endpoints actually negotiated the target hybrid group, rather than silently falling back to plain X25519 because one side lacked the configuration — such a fallback raises no error, makes the whole experiment measure the wrong object, and produces numbers that look suspiciously good. Likewise, the certificate chain’s signature algorithm, the session-ticket switch and certificate compression must each be recorded and held identical across groups. The complete variable-control list should be preserved as an experiment appendix together with the raw data — packet captures, per-message byte tables, and the raw timing of every repetition, not just the aggregated statistics. Raw data retention matters because future reviewers can re-interpret with a different statistical lens instead of having to accept the author’s conclusion.

Variable control and interpretation

Variables to lock down across the whole experiment: TLS library and version, the rest of the cipher configuration (the certificate chain must be identical and the signature algorithm unchanged), session resumption off, 0-RTT off, and a fixed CPU frequency policy on the test machine. Session resumption is the easiest to overlook: if the client resumes a previous session, the second handshake never performs a full key exchange, the samples are systematically contaminated — and the contamination points exactly in the direction of “hybrid looks fast”.

Three rules for interpretation. Size is judged against the arithmetic expectation; a measured deviation beyond five percent sends you back to inspect the encoding. Compute overhead is read from the difference of medians and then translated into capacity language — handshakes per second — before any conclusion is drawn. On the link side, only changes in round-trip count count as findings, not absolute milliseconds: milliseconds drift with the environment, while round-trip counts are structural. If hybrid mode adds bytes but no round trips, and the compute overhead fits the capacity budget, the verdict is deployable; otherwise the problem most likely sits in congestion windows or fragmentation, not in the algorithm.

Common pitfalls

First, treating browser telemetry from the live internet as an experimental conclusion: it mixes in all the noise of carriers, CDNs and endpoints, and serves only as background. Second, measuring only the client: decapsulation and certificate signing costs land on the server, so skipping it drops half the bill. Third, hiding the tail behind averages: the users hurt by slow handshakes are never the median ones but those hit by loss and retransmission, so percentiles are mandatory. Fourth, forgetting to record implementation versions: hybrid key-exchange identifiers and encodings changed repeatedly during the draft phase, and a number without a version is unreproducible within months.

Tags: TLS 1.3Hybrid Key ExchangeML-KEMExperiment Design