Performance

Receive throughput and latency of rawether's block ring, frame ring and plain paths against libpcap (the pcap crate) and pnet_datalink, measured over a veth pair, with the method and the command to reproduce it.

Measured on 2026-11-09 with scripts/bench.sh --docker: Linux 7.0.14 (Docker Desktop, linuxkit), 14 CPUs, aarch64, Rust 1.99.1.

ReceiverFrames/s receivedReceived of 500 000Latency p50p99max
rawether, block ring (default)2 774 k100.0 %513 µs949 µs1 157 µs
rawether, frame ring (RxMode::low_latency())1 661 k100.0 %15 µs41 µs108 µs
rawether, plain (recvmsg)968 k50.5 %16 µs40 µs130 µs
pcap 2 (libpcap, immediate mode)1 563 k100.0 %15 µs35 µs135 µs
pnet_datalink 0.351 223 k57.2 %16 µs47 µs1 896 µs

Reading the numbers#

  • Throughput: the block ring. The TPACKET_V3 ring keeps up with a saturating sender and receives every frame, at about 1.8× libpcap’s rate. Paths that copy one frame per system call (rawether plain, pnet) fall behind and the kernel drops the rest. Those drops are counted, not hidden: see stats().
  • Latency: the frame ring. A block ring hands over a block when it is full or when retire_ms (1 ms) expires, so a lone frame waits up to a millisecond. The TPACKET_V2 frame ring wakes per frame, at about 15 µs, and still receives every frame at saturation: the same design as libpcap’s immediate mode, slightly faster. The plain path has the same latency but drops at saturation.
  • These are comparisons on one machine. Docker Desktop runs a VM, so absolute numbers on bare metal will differ.

Method#

  • Pair: a veth pair in one container (rwbench0 → rwbench1).
  • Sender: rawether, the same for every receiver.
  • Throughput: 500 000 frames of 60 octets, sent in batches of 64 as fast as possible. The rate is counted from a receiver’s first frame to its last.
  • Latency: 5 000 frames, one every 200 µs, each carrying its CLOCK_MONOTONIC send time. The receiver records receipt time minus send time.
  • Filters: rawether and pcap filter the test EtherType in the kernel (ether proto 0x88b5 for pcap). pnet has no kernel filter, so it receives everything and filters in user space, as its users do.
  • End of a run: the sender sends end-of-run frames after the measured traffic, because libpcap ignores its timeout in immediate mode.

Reproduce#

scripts/bench.sh --docker     # any host with Docker
scripts/bench.sh              # Linux with libpcap-dev; the harness runs with sudo

The harness is bench/, a crate of its own that is not part of the published package.

Edit this page on GitHub