tokio-rs / io-uring

The `io_uring` library for Rust
Apache License 2.0
1.16k stars 129 forks source link

Achieving higher throughput #291

Open bits0rcerer opened 2 months ago

bits0rcerer commented 2 months ago

From time to time I am playing around with iouring for networking.. espacially tcp connections. Today I did a basic comparison on good ol` tokio vs iouring (using registered buffers, buf_ring and recv_multishot). My goal was to receive as many bytes as possible per second.

I was pretty sure I wont reach tokio`s battle-tested performance in an afternoon but even so I was surprised that tokio reached ~2 times the throughput.

Tokio: ~110 Gbit/s io-uring: ~55 GBit/s

Network: loopback (127.0.0.1) Kernel: 6.9.6-zen1-1-zen CPU: AMD Ryzen 9 5900X (24) @ 3.700GHz

I used btop to meassure the throughput and #290 for the iouring buf_ring.

Maybe someone here can point out any obvious skill issues on my side or give some general advice.

iouring_tcp_sink.rs

tokio_tcp_sink.rs

tokio_tcp_src.rs