Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Run the examples

The examples are in the examples/ crate. This crate is not a workspace member. Run the commands from examples/, or add --manifest-path examples/Cargo.toml from the repository root.

ExampleWhat it showsFeatures
ping_pongRound-trip time for unary messages between two instanceszmq, grpc, quic or ucx for those transports
throughputMessages per second and bytes per second for sequential, concurrent, and pipelined sends, and for streams (--modes stream), and p50/p95/p99 for sequential and concurrent sendszmq, grpc, quic or ucx for those transports
tx_budgetThe latency budget of the send path, one layer at a timenone
mpsc_faninMany producers into one MPSC anchornone
batched_streamingBatched streaming over the mux, in the shape of LLM servingnone
response_plane_benchLoad harness for the streaming response planenone
stream_lifecycleWhat a producer pays to learn that a stream's output left its nodenone
anchor_setup_benchWhat an SPSC anchor costs to create, attach and finish, and what an unattached anchor holdsnone
rendezvous_rdma_two_procTwo processes that move 8 MiB by RDMA GETucx
soakStress and correctness driver for messaging, streams, and rendezvousgrpc

Messaging examples

cargo run --example ping_pong --all-features -- --rounds 1000
cargo run --example throughput --all-features -- --count 10000
cargo run --example mpsc_fanin --all-features -- --producers 4 --items 40

ping_pong and throughput take --transport {tcp,uds,zmq,nats,grpc,quic,ucx}. The default is tcp. The nats transport needs a nats-server on 127.0.0.1:4222.

The latency budget (tx_budget)

tx_budget adds one layer on each rung. The difference between two rungs is the cost of the layer that was added.

RungWhat it adds
l0Blocking write and read on OS threads: the syscall and the kernel round trip
l1The same bytes over tokio: the reactor, the task wake, and the scheduler
l2TcpFrameCodec encode and decode
l3The full Transport::send_message path, up to the consumer

Each rung is an echo ping-pong of the same frame size in both directions, so the one-way time is half of the round trip. Use tx_budget to find which layer caused a change in latency.

Soak

soak messenger|stream|rendezvous|all --transport tcp|grpc --tier ci|nightly|long [--faults]

CI runs the ci tier on each PR. A nightly workflow runs the full set.

Benchmarks

For batched_streaming, response_plane_bench, stream_lifecycle and anchor_setup_bench, see Benchmarking. For rendezvous_rdma_two_proc, see Run rendezvous over RDMA.