Hacker News

Linux 7.5 To Introduce An In-Kernel QUIC Implementation

48 points by voxadam ago | 7 comments

Veserv [-]

I continue to be baffled by why every single QUIC implementation has such poor performance. This implementation struggles to reach 5 Gb/s [1] with encryption disabled.

To explain clearly, we can consider a transport protocol to consist of a data plane, i.e. copying bytes from place to place, and a control plane, i.e. deciding which bytes are needed and where they need to go. If you have a data plane that can operate at a rate of D bits/s and a control plane that can operate at a rate of C bits/s then the total rate will be the sum of rates: 1 / ((1 / D) + (1 / C)).

You can achieve a 3-copy data plane with zero thought by doing a copy from the memory where the NIC DMA's (puts) the memory to a generic memory storage area. A copy from the generic memory storage area to the QUIC stream. And finally a copy from the QUIC stream to the user. On any system with a 100 Gb/s NIC like the benchmark linked you are almost certainly going to have at least ~100 Gb/s of memory copy, so a zero thought data plane should be operating at ~33 Gb/s.

Assuming a ~33 Gb/s data plane, that would mean their control plane is bottlenecking at ~5-6 Gb/s. If we cut the memory bandwidth in half, still only ~7 Gb/s of control plane. If we double the number of copys on top of that the control plane would still only be getting ~12 Gb/s. At a 1500 byte MTU, 12000 bits, that is barely a million packets per second of control plane after making the data plane 4x slower than it should be. That is so slow it is baffling.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-n...

wahern |root |parent |next [-]

Part of it might be encryption. Even the most optimal use of AES-NI caps out at about 10Gb/s per core: https://samlaf.github.io/programming/single-core-aes.html And that doesn't include MAC calculation.

But that also points to a likely, much more important culprit: parallelism. I'd guess most if not all userspace (non-DPDK) QUIC implementations, especially inbound, have a serialization problem (or multiple problems) dequeueing and routing packets internally. QUIC, especially userspace QUIC, is going to have difficulties fully benefitting from the mature hardware and software TCP and UDP queueing optimizations in kernels and NICs. Not impossible, especially in fast path, but it's more complicated than just the TCP/UDP 4-tuple so your data structures will be more complicated, too. It'll be easier in-kernel, but it'll take time to mature.

Veserv |root |parent |next [-]

Your link shows a peak per-core encryption throughput of ~50 GB/s (~400 Gb/s). Even not relying on vector AES it achieves ~12 GB/s (~100 Gb/s).

Also I was citing the no-encryption number. But even if I misread the benchmark, encryption at 100 Gb/s would not be the bottleneck.

wahern |root |parent [-]

Oops. I missed the vectored AES intrinsic. But I think QUIC payload sizes are capped to avoid UDP fragmention, so you can really only do less than 1.5KB per message.

But I agree encryption doesn't really explain the issue, though without alot of careful thought about how all a QUIC stack's pieces fit together it would be easy to do alot of strictly unnecessary data copying, especially if your initial focus is principally correctness and safety.

robotresearcher |root |parent |previous [-]

> Part of it might be encryption.

>> This implementation struggles to reach 5 Gb/s with encryption disabled.

drewg123 |root |parent |previous [-]

Something seems really slow with their results even for TCP. They only get 23gb from a 100g network with TCP!

Veserv |root |parent [-]

That does not seem too uncharacteristic for a single software TCP connection with untuned parameters.

They probably should have done at least basic parameter tuning for high bandwidth use cases before benchmarking, like increasing buffer sizes, but it is not too unreasonable to use a default parameter set.

It is still kind of silly that the default parameter set does not properly scale up to modest speeds like 100 Gb/s, but that is fairly orthogonal to just how slow these QUIC implementations are even against poorly tuned parameters.