Skip to main content

Benchmarks

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

Against a raw client​

The first chart runs one scenario three ways on a real RabbitMQ node. Raw client drives lapin directly, by a loop written by hand. Broker crate is the same loop over this crate: the broker, the queue descriptor, the subscription stream, the delivery's own ack and its publisher, with no runtime around them. RustStream is the service a user writes, a #[subscriber] handler in an app, publishing through the same publisher. 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.

The two scenarios are the two queue types RabbitMQ ships. A classic queue holds its messages in memory and settles a delivery with a single frame. A quorum queue replicates every message through Raft and writes it down before it hands it out, and a transport that expensive leaves little room for anything above it to show.

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 LapinBroker against the same node. The count includes the framework's dispatch, the codec, this crate's code and the work lapin does on that thread. lapin reads and writes the socket on a thread of its own, which is not counted. Most of a row's allocations are the client's: every acknowledgement and every publish creates promises and an internal task on the service's thread. Cold start is what connecting, opening the channels, declaring the queue, registering the consumer and taking the first delivery 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-lapin 0.7.0 on ruststream 0.7.0, AMD Ryzen 9 7900X 12-Core Processor, Linux 7.2.10-x64v3-xanmod1-1, rabbitmq:4-management-alpine in Docker on localhost, measured 2026-10-18. How the numbers were taken

Classic queue, 512 B JSON, ack each
  • indistinguishable
  • indistinguishable
Quorum queue, 512 B JSON, ack each
  • indistinguishable
  • indistinguishable
Show the numbers as a table
ScenarioRaw clientBroker crateRustStreamOverhead
Classic queue, 512 B JSON, ack each63,187 msg/s (62,538)63,001 msg/s (62,226) (indistinguishable over the client)61,650 msg/s (60,015)indistinguishable
Quorum queue, 512 B JSON, ack each33,202 msg/s (32,709)32,788 msg/s (32,446) (indistinguishable over the client)33,272 msg/s (33,183)indistinguishable
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-lapin default (none), ruststream macros,json. ruststream-lapin 0.7.0, ruststream 0.7.0, measured 2026-10-18.

Instructions
Allocations
classic queue, JSON decode into a small struct, ack each
14,617
16
classic queue, reply published through LapinPublish
22,145.8
27
classic queue, batches of 64 assembled on the client
14,994.4
16.3
Show the numbers as a table
ScenarioInstructionsAllocationsCold start
classic queue, JSON decode into a small struct, ack each14,61716370,049 / 217
classic queue, reply published through LapinPublish22,145.827367,859 / 219
classic queue, batches of 64 assembled on the client14,994.416.3377,775 / 223

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
Brokerrabbitmq:4-management-alpine in Docker on localhost
Round trip69.8 us for one basic.qos answered by the server
Compiler1.99.0
Build profilebench, inheriting release (opt-level = 3, lto = fat, codegen-units = 16, debug = line-tables-only)
Featuresruststream-lapin 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.