What it is. The networking layer the rest of the stack rides on — messages move without copies, straight from one buffer to the wire and back — tens of millions a second on a single connection, hundreds of millions fanned out across many.
The problem it kills. Most systems pay a tax on every message: serialize, copy into the kernel, copy out, deserialize. Where you'd reach for Kafka or a socket library, Nio deletes those copies — the round-trip is microseconds, not milliseconds.
For example. It's what carries replication between nodes in the failover demo — fast enough that a standby stays within one unsealed segment of the leader. The run below is a real harness, captured live.
See it carry a cluster ⟶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 |
Read it straight. Nio matches hand-rolled raw sockets on raw push, beats everything on latency, and leaves the high-level frameworks — gRPC, WebSockets — 100–1000× behind. But raw throughput isn't the headline. 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. Push the same test to 1,000 connections:
| 1,000 connections | Aggregate | OS threads | Thread memory | 1s 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 (127.0.0.1),
via the C# wrapper — the niolib core is faster. 64-byte messages; throughput is
time-boxed, median of repeated runs. "raw thread-per-conn" = one OS thread per socket
per side, the naïve blocking model. Full harness in samples/Nio.Benchmarks.
loading…