Menu

Engineering experiments

How I improved and load-tested the LP2LN core

The TCP and QUIC changes in LP2LN, the trade-offs found in a matched A/B test, and where a protected flow plateaus under load.

Egor DudkinMeasurements through 24 November 2026
Conceptual image of file transfer across a laptop, an iPad and an iPhone

I wanted to answer two questions. Would the LP2LN core keep delivering the right messages when operations competed, and how many messages would the receiving application actually read under load? Counting send calls alone could not answer either. The tests verified received identifiers, sizes, and uniqueness. Latency was measured from the send call to the application read.

TCP and small messages

The first clear problem was a short TCP echo. The harness sent a 4-byte length followed by a 64-byte message in separate writes. With framing held constant and 40 warm observations per setting, median RTT was 87.99 ms with Nagle enabled and 47.7 µs with TCP_NODELAY on both endpoints. That matches the interaction between small writes, Nagle, and delayed ACKs on Linux loopback.

Separate writes for the header and payload were still expensive in bursts. I switched to vectored writes. In a separate microbenchmark, enqueue throughput for 100-byte messages went from 6.30 to 63.36 MiB/s. This measures the writer's enqueue path. The delivery tests count what the receiving application actually reads.

QUIC and the cost of ordering

For reliable QUIC, I checked every expected message at the receiver. Under competing load, a small number of valid messages had previously been rejected by the replay check. After a change to send ordering, the 1,200-byte case delivered 8,000 out of 8,000 across ten runs. The earlier reference run delivered 797 out of 800.

Ordering the receive path increased queue pressure in the 8 KiB burst. I then parallelized authentication while preserving the order of replay-state updates. The A/B used the same source and test rig with four pinned logical CPUs. Each variant ran three times.

MeasureSerialParallel authentication
QUIC 8 KiB · subscriber-confirmed goodput37.56 MiB/s55.81 MiB/s
QUIC 64 KiB · subscriber-confirmed goodput149.12 MiB/s137.06 MiB/s
Mean ingress queue wait8.24 ms1.12 ms
p95 / p99 at 50 messages/s, 100 B3.11 / 8.83 ms5.29 / 5.84 ms

At 8 KiB, delivered goodput rose by about 49% and mean queue wait fell by about 86%. The central estimates moved in the opposite direction at 64 KiB, with overlapping observed spreads. In the 50 messages/s profile, p99 improved while p95 rose. Each result describes its own workload.

Protected flow capacity

The 120-byte matrix used two peers in one Linux process with four Tokio worker threads. Both sides offered messages simultaneously. The horizontal axis shows actual offered load and the vertical axis counts unique messages read by the application. The protected-flow points average two five-second runs.

Protected Flow at 120 bytes. Delivery plateaus at around ten thousand messages per second as offered load increases.

At a target of 10,000 messages/s, a separate 30-second run delivered 290,092 and 290,649 messages in the two directions. It delivered every message actually offered. The worse direction had 1.45 ms p95 and 5.9 ms p99. In a separate test, four concurrent flows delivered a combined 39.36k messages/s per direction at 99.85% delivery.

What standalone Quinn delivered

I ran a standalone Quinn DATAGRAM endpoint pair on the same kind of local setup. At around 200k offered messages/s, it delivered 198.6k messages/s at 99.45% delivery. The highest measured mean delivery was 354.2k/s at 91.0%. Beyond that point, offering more messages reduced actual delivery.

Quinn DATAGRAM at 120 bytes. Both delivery share and absolute delivered rate fall under overload.

The two graphs describe different workloads. Protected Flow adds Core checks, admission rules, pacing, and deadlines. The unit is an application message. Multiple QUIC DATAGRAM frames can share one network packet.

What I am testing next

In the 20-minute voice profile at a target of 50 messages/s, the two sides delivered 59,667 and 59,671 messages. Application handoff p95 was 1.4 ms on the test rig. The measurement covers local message delivery outside the device's audio path.

I keep separate checks for reliable delivery, small real-time messages, and voice under competing file traffic. Next I want to measure delivery across path changes, measure relay load, and extend the connectivity scenarios across networks.

LP2LN case study · Research

Sources

Related projects