rapidfire
Low-latency in-process async MPMC and MPSC channels for Rust.
Status from GitHub and crates.io as of 2026-11-16.
What it is
rapidfire provides async MPMC and MPSC channels for Rust, built for WebSocket fan-in, trading bots and other message pipelines. The default build depends only on std.
Both channel kinds offer bounded back-pressure and unbounded queues, async send and recv, non-blocking try_send and try_recv, explicit close, queue length and sender counts, and work with any executor that polls standard futures. Version 0.2 adds an exclusive MPSC receiver with batched receive.
- MPMC: cloneable senders and receivers; MPSC: one receiver with recv_many batching.
- 40 producers, bounded(4096), 1 KiB messages on a Ryzen 7950X: MPSC 57 ns/message vs MPMC 250 ns.
- Measured across 12 machines; the full report includes workloads where MPSC is slower.
- Default build has no dependencies beyond std.
How it works
Linked blocks of slots
Messages live in linked blocks with 63 usable slots. Producer and consumer indices are padded to 128 bytes. Producers reserve a position, write the value and publish the slot with a release store.
Cheap uncontended sends
Unbounded producers use fetch_add on the uncontended path and CAS retries under contention; bounded producers reserve with a capacity check and CAS.
One receiver needs less coordination
General MPMC consumers check publication before advancing the head with CAS, and per-block completion flags prevent recycling a block another consumer still reads. The exclusive MPSC receiver skips that coordination.
Batching amortizes wakeups
A receive batch publishes freed capacity once per chunk and wakes up to that many blocked senders. Blocks stay allocated until the channel is dropped, so memory holds its high-water mark.
Example uses
01. Batched task fan-in
Multiple tasks can feed one exclusive MPSC receiver that uses batched receive.
02. Bounded capacity
Use a bounded channel when producers should wait for available capacity.
03. Competing consumers
MPMC workers compete for messages, and each message is received once rather than broadcast.
Where it fits
rapidfire is an in-process Rust channel. Its waiter lists and recycling pool use mutexes, and allocated blocks remain until channel destruction.
Get started
Add the dependency to Cargo.toml, then use the README for complete examples.
Add to Cargo.toml
[dependencies]
rapidfire = "0.2"Limitations
- In-process only.
- The MPSC receiver is exclusive.
- Choose bounded capacity and measure the workload.
- Throughput does not imply p99 latency; see the current performance report in the repository.
Cite this software · archived version v0.2.0
Cite this software
Alexander Panasenko (2026). rapidfire: Low-latency async MPMC channel for Rust (v0.2.0). Zenodo. https://doi.org/10.5281/zenodo.23028434This record reflects the archived software version deposited on Zenodo for citation and reproducibility, which may differ from subsequent development releases.
