Zero-copy messaging. 16 µs round-trips, and hundreds of millions of messages a second on a handful of threads.
Every figure here goes through the C# wrapper. The native core underneath is faster.
Same machine, same loopback, same 64-byte messages. Nio against the libraries you'd actually reach for.
| Library | Round-trip p50 | Push, 1 conn | Bulk stream |
|---|---|---|---|
| Nio | 16 µs | 28M msg/s | 2.67 GiB/s |
| raw sockets | 52 µs | 28–40M msg/s | 2.34 GiB/s |
| NetCoreServer | 33 µs | 4.0M msg/s | 0.39 GiB/s |
| WebSockets | 67 µs | 75K msg/s | 0.86 GiB/s |
| gRPC | 179 µs | 49K msg/s | 0.15 GiB/s |
Nio matches hand-rolled raw sockets on push, beats everything on latency and leaves gRPC and WebSockets 100 to 1000 times behind. Raw throughput isn't the headline, though. What it costs to scale is.
| 64 connections | Aggregate | OS threads | Per thread |
|---|---|---|---|
| Nio | 206M msg/s | 12 | 17M msg/s |
| raw thread-per-conn | 299M msg/s | 128 | 2.3M msg/s |
Thread-per-connection wins the drag race and loses the war. Here is the same test at 1,000 connections:
| 1,000 connections | Aggregate | OS threads | Thread memory | 1 s push took |
|---|---|---|---|---|
| Nio | 130M msg/s | 12 | ~12 MB | 1.0 s |
| raw thread-per-conn | 307M msg/s | 2,000 | ~2 GB | 7.2 s |
Test bed: AMD Ryzen 9 9950X (16 cores, 32 threads),
64 GB RAM, Windows 11 Pro, .NET 10 Release x64, loopback, through the C#
wrapper. 64-byte messages; throughput is time-boxed, median of repeated runs.
"Raw thread-per-conn" is one OS thread per socket per side, the plain blocking model. Full
harness in samples/Nio.Benchmarks.
The example program in samples/Example runs seven tests over
loopback: batched events, request/response, streaming both ways, mixed queries, broadcast
and multi-client ping-pong.
| Test | LinuxRyzen 9 9950X, io_uring | WindowsRyzen 9 7950X3D, RIO |
|---|---|---|
| Batched events, 10M messages | 99.2M msg/s | 30.0M msg/s |
| Request/response, average round-trip | 5.9 µs | 14.4 µs |
| Ping-pong, 10 clients, average round-trip | 6.4 µs | 14.1 µs |
Linux runs about 2.5 to 3 times faster than Windows in this test. The 16 µs head-to-head figure above comes from a different harness and message size. The streaming and upload tests move under 1 MB, too little to measure bandwidth, so their numbers are only in the raw output.
We're taking a few early users. If your messages spend more time in copies than in your code, tell us what you'd build. You get Nio and direct help; we get your feedback.
info@drylane.io