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
- 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
- indistinguishable
- indistinguishable
- indistinguishable
- indistinguishable
Show the numbers as a table
| Scenario | Raw client | Broker crate | RustStream | Overhead |
|---|---|---|---|---|
| Classic queue, 512 B JSON, ack each | 63,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 each | 33,202 msg/s (32,709) | 32,788 msg/s (32,446) (indistinguishable over the client) | 33,272 msg/s (33,183) | indistinguishable |
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.
Show the numbers as a table
| Scenario | Instructions | Allocations | Cold start |
|---|---|---|---|
| classic queue, JSON decode into a small struct, ack each | 14,617 | 16 | 370,049 / 217 |
| classic queue, reply published through LapinPublish | 22,145.8 | 27 | 367,859 / 219 |
| classic queue, batches of 64 assembled on the client | 14,994.4 | 16.3 | 377,775 / 223 |
The machine
| Processor | AMD Ryzen 9 7900X 12-Core Processor |
|---|---|
| Architecture | x86_64 |
| Frequency | 427-5912 MHz |
| Cores | 12 physical, 24 logical |
| Memory | 62.4 GiB |
| Memory speed | unknown |
| Operating system | Linux 7.2.10-x64v3-xanmod1-1 |
| Broker | rabbitmq:4-management-alpine in Docker on localhost |
| Round trip | 69.8 us for one basic.qos answered by the server |
| Compiler | 1.99.0 |
| Build profile | bench, inheriting release (opt-level = 3, lto = fat, codegen-units = 16, debug = line-tables-only) |
| Features | ruststream-lapin default (none), ruststream macros,json |
| RUSTFLAGS | none (the recipe clears RUSTFLAGS, so the numbers are not tied to this CPU) |
| Valgrind | 3.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.