Skip to main content

Benchmarks

What ruststream-zeromq costs on every message: throughput against the raw zeromq client, and instructions and allocations of its code.

Against a raw client​

The first chart runs each scenario three ways over real sockets. Raw client drives zeromq sockets directly. Broker crate drives this crate's subscription with a loop of its own and no runtime. RustStream is the service a user writes, a #[subscriber] handler in an app. The first gap is what this crate costs over the client it wraps, and the second is what the runtime adds on top.

Each loop is a bar from its best round to its slowest, with a dot at the best round and a notch at the median. The zero of the axis is the raw client's best round, and a dot right of zero is slower. A hollow dot is a loop whose difference from the raw client is smaller than the spread of the rounds. The table under the chart prints the best round with the median in parentheses.

Both scenarios are PUSH/PULL, over the two transports this crate runs on: tcp:// on the loopback and ipc://. They differ in the path a message takes through the kernel and in nothing else, so the pair shows how much of the cost is the socket.

The other end of every loop is a socket in the same process, because ZeroMQ peers talk directly, as Methodology explains.

Cost of the code​

The second chart counts what one message costs on the service's thread: instructions under callgrind and allocations under DHAT, in the steady state. Each scenario is a service on the production broker, bound to a port on the loopback, with a peer on a thread of its own. The count includes the framework's dispatch, this crate's code and the zeromq client's framing on that thread. The peer's thread and the kernel are not counted. Cold start is what starting the service, accepting the peer's connection and taking the first message cost once.

Results​

Against a raw clientHow far each loop falls below the raw client's best round
  • Raw client
  • Broker crate
  • RustStream
  • rounds, best to slowest
  • best round
  • median round
  • spread of the rounds
  • indistinguishable

ruststream-zeromq 0.7.0 on ruststream 0.7.0, AMD Ryzen 9 7900X 12-Core Processor, Linux 7.2.10-x64v3-xanmod1-1, none: ZeroMQ has no broker, so the peer is a PUSH socket in the same process, over tcp:// on the loopback and over ipc://, with default socket options (the zeromq crate exposes no high-water mark), measured 2026-10-18. How the numbers were taken

PUSH/PULL over tcp:// on the loopback, 512 B JSON
  • indistinguishable
  • indistinguishable
PUSH/PULL over ipc://, 512 B JSON
  • indistinguishable
  • +3.4%
Show the numbers as a table
ScenarioRaw clientBroker crateRustStreamOverhead
PUSH/PULL over tcp:// on the loopback, 512 B JSON241,721 msg/s (237,164)238,327 msg/s (237,795) (indistinguishable over the client)241,545 msg/s (231,957)indistinguishable
PUSH/PULL over ipc://, 512 B JSON972,020 msg/s (955,055)952,265 msg/s (934,673) (indistinguishable over the client)939,038 msg/s (936,838)+3.4%
Cost of the code

AMD Ryzen 9 7900X 12-Core Processor, x86_64, 427-5912 MHz, 12 physical, 24 logical, 62.4 GiB, unknown, Linux 7.2.10-x64v3-xanmod1-1, 1.99.0, 3.25.1, bench, inheriting release (opt-level = 3, lto = fat, codegen-units = 16, debug = line-tables-only), ruststream-zeromq default (none), ruststream macros,json. ruststream-zeromq 0.7.0, ruststream 0.7.0, measured 2026-10-18.

Instructions
Allocations
PUSH/PULL on the loopback, JSON decode into a small struct, ack each
5,036.1
5
DEALER/ROUTER on the loopback, answered to the requesting peer
13,686
18
PUSH/PULL on the loopback, in batches of 64 assembled on the client
5,017.1
5
Show the numbers as a table
ScenarioInstructionsAllocationsCold start
PUSH/PULL on the loopback, JSON decode into a small struct, ack each5,036.151,075,776 / 614
DEALER/ROUTER on the loopback, answered to the requesting peer13,686181,090,494 / 632
PUSH/PULL on the loopback, in batches of 64 assembled on the client5,017.151,082,736 / 618

The machine​

ProcessorAMD Ryzen 9 7900X 12-Core Processor
Architecturex86_64
Frequency427-5912 MHz
Cores12 physical, 24 logical
Memory62.4 GiB
Memory speedunknown
Operating systemLinux 7.2.10-x64v3-xanmod1-1
Transportnone: ZeroMQ has no broker, so the peer is a PUSH socket in the same process, over tcp:// on the loopback and over ipc://, with default socket options (the zeromq crate exposes no high-water mark)
Round triptcp:// 15.8 us, ipc:// 11.1 us (20000 REQ/REP exchanges on the same transport, outside every loop)
Compiler1.99.0
Build profilebench, inheriting release (opt-level = 3, lto = fat, codegen-units = 16, debug = line-tables-only)
Featuresruststream-zeromq default (none), ruststream macros,json
RUSTFLAGSnone (the recipe clears RUSTFLAGS, so the numbers are not tied to this CPU)
Valgrind3.25.1

The numbers come from docs/benchmarks/results.json of this version, written by the benchmark recipe. Methodology says how they were taken, and Numbers what they allow you to conclude.