Kafka vs NATS vs RabbitMQ vs Redis Streams benchmarks: durability is the setting that matters

NetworkingArchitecture

Broker comparisons usually put one number next to each name: Kafka does a million messages a second, Redis is faster still, RabbitMQ is slow. Those numbers mostly measure one setting, when the broker writes a message to disk before saying it has it, and that setting is rarely the same across the brokers being compared. This benchmark runs Kafka, NATS JetStream, RabbitMQ and Redis Streams on one machine, on the same cores and the same disk, each at the durability levels it offers, and measures what each level costs and what it buys.

Every message carries its sequence number and a payload derived from it, and every consumer checks every byte: 1,126,740,946 delivered messages, 0 corrupted, 0 duplicated.

SetupDetails
BrokersKafka 4.3.1 (apache/kafka, KRaft, one combined broker and controller, JVM heap at the image default of 1 GB) · NATS 2.15.2 with JetStream · RabbitMQ 4.4.0 (Erlang/OTP 29) · Redis 8.10.3 · official images pinned by digest, one broker running at a time, single node, no replication
ClientsOne Go 1.26 program with each broker’s usual Go library: franz-go 1.22 (Kafka), nats.go 1.55 (NATS), amqp091-go 1.16 (RabbitMQ), go-redis 9.23 (Redis)
What a producer waits forEvery message is acknowledged by the broker: Kafka acks=all, JetStream’s PubAck, RabbitMQ publisher confirms, the reply to Redis XADD · at most 1,000 unacknowledged messages per producer for all four · no compression (Kafka’s client default of Snappy switched off; the payloads are random bytes) · Kafka’s linger set to 0 like the others
TopologyOne topic, stream or queue per test, one partition: Kafka a 1-partition topic, NATS one stream, RabbitMQ a fanout exchange with one queue per consumer, Redis one stream key
CPUAMD Ryzen AI Max+ 395 · cores 0–7 and their SMT siblings reserved for the benchmark (system services and movable IRQs moved to the other CCD) · broker on cores 0–3 (4 cores, 8 threads), clients on cores 4–7
StorageOne directory on an NVMe SSD (ext4), emptied before every broker start · the SSD is shared with other workloads on this machine, which shows in the fsync-bound numbers · the broker’s files are fsynced before every test, so no test starts with the previous one’s writes pending
NetworkLoopback only: brokers and clients share one network namespace. This is a broker benchmark; there is no link emulation
MethodEvery value is 10 runs, each a fresh client process · reported value: median of the runs (mean of the two middle ones), with min–max · latency percentiles per run, then the median across runs

Three durability levels

“Durable” means different things in each broker’s defaults. The table lines them up by when the data reaches the disk relative to the acknowledgement the producer waits for:

DurabilityKafkaNATS JetStreamRabbitMQRedis Streams
fsync before the acknowledgementtopic flush.messages=1: fsync after every append, before the produce responsesync_interval: alwaysquorum queue (fsyncs its log before confirming; cannot be turned off) · classic durable queue with persistent messages (confirmed once persisted to disk, per RabbitMQ’s documentation)appendfsync always
fsync later, in the backgroundthe default: written to the page cache, the OS writes it out whenever it likes; Kafka relies on replication for durability, and there is none on one nodethe default: written to the file at once, fsync every 2 minutes—appendfsync everysec (the default when the AOF is on)
memory only—memory stream— (transient queues are deprecated)no AOF, no RDB snapshots

Ten configurations in all; the charts below keep this colour code: dark for fsync before the acknowledgement, light for fsync later, grey for memory only.

The scoreboard

Each broker at two levels, its default and fsync before every acknowledgement (both RabbitMQ queue types fsync first), against the number everyone quotes, Kafka on the page cache. The memory-only configurations are in the sections.

Scoreboard, median per configuration. Messages/s, 100 B: Kafka, OS writeback 2.46M, Kafka, fsync each write 171k, NATS, fsync every 2 min 326k, NATS, fsync each write 2.2k, RabbitMQ, classic queue 153k, RabbitMQ, quorum queue 104k, Redis, fsync every second 735k, Redis, fsync each write 167k. Messages/s, 1 KiB: Kafka, OS writeback 1.96M, Kafka, fsync each write 168k, NATS, fsync every 2 min 250k, NATS, fsync each write 2.1k, RabbitMQ, classic queue 132k, RabbitMQ, quorum queue 92k, Redis, fsync every second 444k, Redis, fsync each write 31k. Messages/s, 10 KiB: Kafka, OS writeback 274k, Kafka, fsync each write 64k, NATS, fsync every 2 min 92k, NATS, fsync each write 2.0k, RabbitMQ, classic queue 86k, RabbitMQ, quorum queue 50k, Redis, fsync every second 89k, Redis, fsync each write 9.0k. Latency p50 at 10k msg/s: Kafka, OS writeback 36 µs, Kafka, fsync each write 5.36 ms, NATS, fsync every 2 min 25 µs, NATS, fsync each write not sustained, RabbitMQ, classic queue 33 µs, RabbitMQ, quorum queue 861 µs, Redis, fsync every second 15 µs, Redis, fsync each write 774 µs. Latency p99 at 10k msg/s: Kafka, OS writeback 94 µs, Kafka, fsync each write 8.03 ms, NATS, fsync every 2 min 43 µs, NATS, fsync each write not sustained, RabbitMQ, classic queue 83 µs, RabbitMQ, quorum queue 3.92 ms, Redis, fsync every second 55 µs, Redis, fsync each write 1.83 ms. Latency p50 at 50k msg/s: Kafka, OS writeback 49 µs, Kafka, fsync each write 5.47 ms, NATS, fsync every 2 min 21 µs, NATS, fsync each write not sustained, RabbitMQ, classic queue 57 µs, RabbitMQ, quorum queue 1.15 ms, Redis, fsync every second 13 µs, Redis, fsync each write not sustained. Disk per stored 100 B message: Kafka, OS writeback 110 B, Kafka, fsync each write 110 B, NATS, fsync every 2 min 147 B, NATS, fsync each write 147 B, RabbitMQ, classic queue 308 B, RabbitMQ, quorum queue 359 B, Redis, fsync every second 177 B, Redis, fsync each write 177 B. Disk per stored 1 KiB message: Kafka, OS writeback 1,034 B, Kafka, fsync each write 1,034 B, NATS, fsync every 2 min 1,071 B, NATS, fsync each write 1,072 B, RabbitMQ, classic queue 1,232 B, RabbitMQ, quorum queue 1,286 B, Redis, fsync every second 1,102 B, Redis, fsync each write 1,101 B. Best in every run, out of 8 measures: Kafka, OS writeback on 3 · Redis, fsync every second on 2; 3 have no fixed order Eight measures from the sections below · each configuration as a multiple of the best fsync before the acknowledgement fsync later, in the background 1× = the best median; grey line: lowest to highest run 1× (best) 10× 100× 1k× 10k× Messages/s, 100 B Kafka, OS writeback 2.46M Kafka, fsync each write 171k NATS, fsync every 2 min 326k NATS, fsync each write 2.2k RabbitMQ, classic queue 153k RabbitMQ, quorum queue 104k Redis, fsync every second 735k Redis, fsync each write 167k Messages/s, 1 KiB Kafka, OS writeback 1.96M Kafka, fsync each write 168k NATS, fsync every 2 min 250k NATS, fsync each write 2.1k RabbitMQ, classic queue 132k RabbitMQ, quorum queue 92k Redis, fsync every second 444k Redis, fsync each write 31k Messages/s, 10 KiB Kafka, OS writeback 274k Kafka, fsync each write 64k NATS, fsync every 2 min 92k NATS, fsync each write 2.0k RabbitMQ, classic queue 86k RabbitMQ, quorum queue 50k Redis, fsync every second 89k Redis, fsync each write 9.0k Latency p50 at 10k msg/s Kafka, OS writeback 36 µs Kafka, fsync each write 5.36 ms NATS, fsync every 2 min 25 µs NATS, fsync each write not sustained RabbitMQ, classic queue 33 µs RabbitMQ, quorum queue 861 µs Redis, fsync every second 15 µs Redis, fsync each write 774 µs Latency p99 at 10k msg/s Kafka, OS writeback 94 µs Kafka, fsync each write 8.03 ms NATS, fsync every 2 min 43 µs NATS, fsync each write not sustained RabbitMQ, classic queue 83 µs RabbitMQ, quorum queue 3.92 ms Redis, fsync every second 55 µs Redis, fsync each write 1.83 ms Latency p50 at 50k msg/s Kafka, OS writeback 49 µs Kafka, fsync each write 5.47 ms NATS, fsync every 2 min 21 µs NATS, fsync each write not sustained RabbitMQ, classic queue 57 µs RabbitMQ, quorum queue 1.15 ms Redis, fsync every second 13 µs Redis, fsync each write not sustained Disk per stored 100 B message Kafka, OS writeback 110 B Kafka, fsync each write 110 B NATS, fsync every 2 min 147 B NATS, fsync each write 147 B RabbitMQ, classic queue 308 B RabbitMQ, quorum queue 359 B Redis, fsync every second 177 B Redis, fsync each write 177 B Disk per stored 1 KiB message Kafka, OS writeback 1,034 B Kafka, fsync each write 1,034 B NATS, fsync every 2 min 1,071 B NATS, fsync each write 1,072 B RabbitMQ, classic queue 1,232 B RabbitMQ, quorum queue 1,286 B Redis, fsync every second 1,102 B Redis, fsync each write 1,101 B Each bar is that configuration's median as a multiple of the best median for the measure, log scale: 1× is the best, a bar twice as long is twice as costly. Grey line: lowest to highest of the 10 process runs; the median is printed after each bar.
Eight headline measures from the sections below for each broker's default and its fsync-before-acknowledgement setting, each configuration's median as a multiple of the best median for that measure (1×; log scale, a longer bar is worse), labelled with the measured value. Median of 10 process runs; grey line: lowest to highest run. Throughput: one producer, one consumer; latency: 1 KiB messages on a fixed schedule, publish to delivery, left out where the schedule was not kept; disk: a backlog with no consumer.
Scoreboard, median per configuration. Messages/s, 100 B: Kafka, OS writeback 2.46M, Kafka, fsync each write 171k, NATS, fsync every 2 min 326k, NATS, fsync each write 2.2k, RabbitMQ, classic queue 153k, RabbitMQ, quorum queue 104k, Redis, fsync every second 735k, Redis, fsync each write 167k. Messages/s, 1 KiB: Kafka, OS writeback 1.96M, Kafka, fsync each write 168k, NATS, fsync every 2 min 250k, NATS, fsync each write 2.1k, RabbitMQ, classic queue 132k, RabbitMQ, quorum queue 92k, Redis, fsync every second 444k, Redis, fsync each write 31k. Messages/s, 10 KiB: Kafka, OS writeback 274k, Kafka, fsync each write 64k, NATS, fsync every 2 min 92k, NATS, fsync each write 2.0k, RabbitMQ, classic queue 86k, RabbitMQ, quorum queue 50k, Redis, fsync every second 89k, Redis, fsync each write 9.0k. Latency p50 at 10k msg/s: Kafka, OS writeback 36 µs, Kafka, fsync each write 5.36 ms, NATS, fsync every 2 min 25 µs, NATS, fsync each write not sustained, RabbitMQ, classic queue 33 µs, RabbitMQ, quorum queue 861 µs, Redis, fsync every second 15 µs, Redis, fsync each write 774 µs. Latency p99 at 10k msg/s: Kafka, OS writeback 94 µs, Kafka, fsync each write 8.03 ms, NATS, fsync every 2 min 43 µs, NATS, fsync each write not sustained, RabbitMQ, classic queue 83 µs, RabbitMQ, quorum queue 3.92 ms, Redis, fsync every second 55 µs, Redis, fsync each write 1.83 ms. Latency p50 at 50k msg/s: Kafka, OS writeback 49 µs, Kafka, fsync each write 5.47 ms, NATS, fsync every 2 min 21 µs, NATS, fsync each write not sustained, RabbitMQ, classic queue 57 µs, RabbitMQ, quorum queue 1.15 ms, Redis, fsync every second 13 µs, Redis, fsync each write not sustained. Disk per stored 100 B message: Kafka, OS writeback 110 B, Kafka, fsync each write 110 B, NATS, fsync every 2 min 147 B, NATS, fsync each write 147 B, RabbitMQ, classic queue 308 B, RabbitMQ, quorum queue 359 B, Redis, fsync every second 177 B, Redis, fsync each write 177 B. Disk per stored 1 KiB message: Kafka, OS writeback 1,034 B, Kafka, fsync each write 1,034 B, NATS, fsync every 2 min 1,071 B, NATS, fsync each write 1,072 B, RabbitMQ, classic queue 1,232 B, RabbitMQ, quorum queue 1,286 B, Redis, fsync every second 1,102 B, Redis, fsync each write 1,101 B. Best in every run, out of 8 measures: Kafka, OS writeback on 3 · Redis, fsync every second on 2; 3 have no fixed order Eight measures from the sections below · each configuration as a multiple of the best fsync before the acknowledgement fsync later, in the background 1× = the best median; grey line: lowest to highest run 1× (best) 10× 100× 1k× 10k× Messages/s, 100 B Kafka, OS writeback 2.46M Kafka, fsync each write 171k NATS, fsync every 2 min 326k NATS, fsync each write 2.2k RabbitMQ, classic queue 153k RabbitMQ, quorum queue 104k Redis, fsync every second 735k Redis, fsync each write 167k Messages/s, 1 KiB Kafka, OS writeback 1.96M Kafka, fsync each write 168k NATS, fsync every 2 min 250k NATS, fsync each write 2.1k RabbitMQ, classic queue 132k RabbitMQ, quorum queue 92k Redis, fsync every second 444k Redis, fsync each write 31k Messages/s, 10 KiB Kafka, OS writeback 274k Kafka, fsync each write 64k NATS, fsync every 2 min 92k NATS, fsync each write 2.0k RabbitMQ, classic queue 86k RabbitMQ, quorum queue 50k Redis, fsync every second 89k Redis, fsync each write 9.0k p50 at 10k msg/s Kafka, OS writeback 36 µs Kafka, fsync each write 5.36 ms NATS, fsync every 2 min 25 µs NATS, fsync each write not sustained RabbitMQ, classic queue 33 µs RabbitMQ, quorum queue 861 µs Redis, fsync every second 15 µs Redis, fsync each write 774 µs p99 at 10k msg/s Kafka, OS writeback 94 µs Kafka, fsync each write 8.03 ms NATS, fsync every 2 min 43 µs NATS, fsync each write not sustained RabbitMQ, classic queue 83 µs RabbitMQ, quorum queue 3.92 ms Redis, fsync every second 55 µs Redis, fsync each write 1.83 ms p50 at 50k msg/s Kafka, OS writeback 49 µs Kafka, fsync each write 5.47 ms NATS, fsync every 2 min 21 µs NATS, fsync each write not sustained RabbitMQ, classic queue 57 µs RabbitMQ, quorum queue 1.15 ms Redis, fsync every second 13 µs Redis, fsync each write not sustained Disk per 100 B message Kafka, OS writeback 110 B Kafka, fsync each write 110 B NATS, fsync every 2 min 147 B NATS, fsync each write 147 B RabbitMQ, classic queue 308 B RabbitMQ, quorum queue 359 B Redis, fsync every second 177 B Redis, fsync each write 177 B Disk per 1 KiB message Kafka, OS writeback 1,034 B Kafka, fsync each write 1,034 B NATS, fsync every 2 min 1,071 B NATS, fsync each write 1,072 B RabbitMQ, classic queue 1,232 B RabbitMQ, quorum queue 1,286 B Redis, fsync every second 1,102 B Redis, fsync each write 1,101 B Each bar is that configuration's median as a multiple of the best median for the measure, log scale: 1× is the best, a bar twice as long is twice as costly. Grey line: lowest to highest of the 10 process runs; the median is printed after each bar.
Eight headline measures from the sections below for each broker's default and its fsync-before-acknowledgement setting, each configuration's median as a multiple of the best median for that measure (1×; log scale, a longer bar is worse), labelled with the measured value. Median of 10 process runs; grey line: lowest to highest run. Throughput: one producer, one consumer; latency: 1 KiB messages on a fixed schedule, publish to delivery, left out where the schedule was not kept; disk: a backlog with no consumer.
MeasureKafka, OS writebackKafka, fsync each writeNATS, fsync every 2 minNATS, fsync each writeRabbitMQ, classic queueRabbitMQ, quorum queueRedis, fsync every secondRedis, fsync each write
Messages/s, 100 B2.46M
2.36M–2.48M
171k
150k–186k · 0.07×
326k
323k–332k · 0.13×
2.2k
268–2.3k · 0.0009×
153k
146k–160k · 0.062×
104k
99k–106k · 0.042×
735k
657k–744k · 0.30×
167k
39k–177k · 0.068×
Messages/s, 1 KiB1.96M
1.82M–2.05M
168k
151k–175k · 0.085×
250k
248k–254k · 0.13×
2.1k
537–2.2k · 0.0011×
132k
130k–135k · 0.067×
92k
81k–92k · 0.047×
444k
369k–451k · 0.23×
31k
28k–32k · 0.016×
Messages/s, 10 KiB274k
206k–299k
64k
34k–64k · 0.23×
92k
90k–95k · 0.34×
2.0k
356–2.0k · 0.0072×
86k
85k–87k · 0.31×
50k
16k–55k · 0.18×
89k
64k–106k · 0.33×
9.0k
4.0k–9.1k · 0.033×
Latency p50 at 10k msg/s36 µs
35–37 µs
5.36 ms
5.20–123 ms · 0.0067×
25 µs
24–25 µs · 1.5×
not sustained33 µs
31–33 µs · 1.1×
861 µs
832 µs–68.7 ms · 0.042×
15 µs
14–15 µs · 2.4×
774 µs
763 µs–160 ms · 0.046×
Latency p99 at 10k msg/s94 µs
82 µs–117 ms
8.03 ms
6.68–687 ms · 0.012×
43 µs
42 µs–7.73 ms · 2.2×
not sustained83 µs
76–89 µs · 1.1×
3.92 ms
1.42–248 ms · 0.024×
55 µs
29 µs–122 ms · 1.7×
1.83 ms
1.47–1,129 ms · 0.051×
Latency p50 at 50k msg/s49 µs
48–50 µs
5.47 ms
5.40–307 ms · 0.0089×
21 µs
21 µs · 2.3×
not sustained57 µs
55–60 µs · 0.86×
1.15 ms
1.12–658 ms · 0.042×
13 µs
13 µs · 3.8×
not sustained
Disk per stored 100 B message110 B
110 B
110 B
110–111 B · same
147 B
147 B · 0.75×
147 B
147–148 B · 0.75×
308 B
308 B · 0.36×
359 B
359 B · 0.31×
177 B
177 B · 0.62×
177 B
176–177 B · 0.63×
Disk per stored 1 KiB message1,034 B
1,034 B
1,034 B
1,034 B · same
1,071 B
1,071 B · 0.97×
1,072 B
1,072–1,073 B · 0.97×
1,232 B
1,232 B · 0.84×
1,286 B
1,286 B · 0.80×
1,102 B
1,102 B · 0.94×
1,101 B
1,101 B · 0.94×

Median of 10 process runs, lowest to highest run beneath; bold: best in every run; after the range, the factor against Kafka, OS writeback: above 1× better than Kafka, OS writeback, below 1× worse, same: rounds to 1×.

Counting a measure only where every run agrees, against Kafka, OS writeback: Kafka, fsync each write is never better: worse on 5 (down to 0.0067× on latency p50 at 10k msg/s) and ties on 3; NATS, fsync every 2 min is better on 2 (up to 2.3× on latency p50 at 50k msg/s), worse on 5 (down to 0.13× on messages/s, 1 KiB) and ties on 1; NATS, fsync each write is never better: worse on all of its 5 (down to 0.0009× on messages/s, 100 B); RabbitMQ, classic queue is better on 1 (up to 1.1× on latency p50 at 10k msg/s), worse on 6 (down to 0.062× on messages/s, 100 B) and ties on 1; RabbitMQ, quorum queue is never better: worse on 7 (down to 0.042× on latency p50 at 10k msg/s) and ties on 1; Redis, fsync every second is better on 2 (up to 3.8× on latency p50 at 50k msg/s), worse on 5 (down to 0.23× on messages/s, 1 KiB) and ties on 1; Redis, fsync each write is never better: worse on all of its 7 (down to 0.016× on messages/s, 1 KiB). The sections below take each measure in turn, with the memory-only configurations, fan-out, the kill -9 test and the runs behind every median.

Factor against Kafka, OS writeback per measure, above 1 is better. Messages/s, 100 B: Kafka, fsync each write 0.07×, NATS, fsync every 2 min 0.13×, NATS, fsync each write 0.0009×, RabbitMQ, classic queue 0.062×, RabbitMQ, quorum queue 0.042×, Redis, fsync every second 0.30×, Redis, fsync each write 0.068×. Messages/s, 1 KiB: Kafka, fsync each write 0.085×, NATS, fsync every 2 min 0.13×, NATS, fsync each write 0.0011×, RabbitMQ, classic queue 0.067×, RabbitMQ, quorum queue 0.047×, Redis, fsync every second 0.23×, Redis, fsync each write 0.016×. Messages/s, 10 KiB: Kafka, fsync each write 0.23×, NATS, fsync every 2 min 0.34×, NATS, fsync each write 0.0072×, RabbitMQ, classic queue 0.31×, RabbitMQ, quorum queue 0.18×, Redis, fsync every second 0.33×, Redis, fsync each write 0.033×. Latency p50 at 10k msg/s: Kafka, fsync each write 0.0067×, NATS, fsync every 2 min 1.5×, NATS, fsync each write not sustained, RabbitMQ, classic queue 1.1×, RabbitMQ, quorum queue 0.042×, Redis, fsync every second 2.4×, Redis, fsync each write 0.046×. Latency p99 at 10k msg/s: Kafka, fsync each write 0.012×, NATS, fsync every 2 min 2.2×, NATS, fsync each write not sustained, RabbitMQ, classic queue 1.1×, RabbitMQ, quorum queue 0.024×, Redis, fsync every second 1.7×, Redis, fsync each write 0.051×. Latency p50 at 50k msg/s: Kafka, fsync each write 0.0089×, NATS, fsync every 2 min 2.3×, NATS, fsync each write not sustained, RabbitMQ, classic queue 0.86×, RabbitMQ, quorum queue 0.042×, Redis, fsync every second 3.8×, Redis, fsync each write not sustained. Disk per stored 100 B message: Kafka, fsync each write 1.00×, NATS, fsync every 2 min 0.75×, NATS, fsync each write 0.75×, RabbitMQ, classic queue 0.36×, RabbitMQ, quorum queue 0.31×, Redis, fsync every second 0.62×, Redis, fsync each write 0.63×. Disk per stored 1 KiB message: Kafka, fsync each write 1.00×, NATS, fsync every 2 min 0.97×, NATS, fsync each write 0.97×, RabbitMQ, classic queue 0.84×, RabbitMQ, quorum queue 0.80×, Redis, fsync every second 0.94×, Redis, fsync each write 0.94×. Against Kafka, OS writeback, 8 measures: NATS, fsync every 2 min better on 2 · RabbitMQ, classic queue on 1 · Redis, fsync every second on 2; never better: Kafka, fsync each write · NATS, fsync each write · RabbitMQ, quorum queue · Redis, fsync each write Medians of 10 process runs · log scale · above 1× is better than Kafka, OS writeback fsync before the acknowledgement fsync later, in the background 0.001× 0.01× 0.1× 1× (parity) Messages/s, 100 B Kafka, fsync each write 0.07× NATS, fsync every 2 min 0.13× NATS, fsync each write 0.0009× RabbitMQ, classic queue 0.062× RabbitMQ, quorum queue 0.042× Redis, fsync every second 0.30× Redis, fsync each write 0.068× Messages/s, 1 KiB Kafka, fsync each write 0.085× NATS, fsync every 2 min 0.13× NATS, fsync each write 0.0011× RabbitMQ, classic queue 0.067× RabbitMQ, quorum queue 0.047× Redis, fsync every second 0.23× Redis, fsync each write 0.016× Messages/s, 10 KiB Kafka, fsync each write 0.23× NATS, fsync every 2 min 0.34× NATS, fsync each write 0.0072× RabbitMQ, classic queue 0.31× RabbitMQ, quorum queue 0.18× Redis, fsync every second 0.33× Redis, fsync each write 0.033× Latency p50 at 10k msg/s Kafka, fsync each write 0.0067× NATS, fsync every 2 min 1.5× NATS, fsync each write not sustained RabbitMQ, classic queue 1.1× RabbitMQ, quorum queue 0.042× Redis, fsync every second 2.4× Redis, fsync each write 0.046× Latency p99 at 10k msg/s Kafka, fsync each write 0.012× NATS, fsync every 2 min 2.2× NATS, fsync each write not sustained RabbitMQ, classic queue 1.1× RabbitMQ, quorum queue 0.024× Redis, fsync every second 1.7× Redis, fsync each write 0.051× Latency p50 at 50k msg/s Kafka, fsync each write 0.0089× NATS, fsync every 2 min 2.3× NATS, fsync each write not sustained RabbitMQ, classic queue 0.86× RabbitMQ, quorum queue 0.042× Redis, fsync every second 3.8× Redis, fsync each write not sustained Disk per stored 100 B message Kafka, fsync each write same NATS, fsync every 2 min 0.75× NATS, fsync each write 0.75× RabbitMQ, classic queue 0.36× RabbitMQ, quorum queue 0.31× Redis, fsync every second 0.62× Redis, fsync each write 0.63× Disk per stored 1 KiB message Kafka, fsync each write same NATS, fsync every 2 min 0.97× NATS, fsync each write 0.97× RabbitMQ, classic queue 0.84× RabbitMQ, quorum queue 0.80× Redis, fsync every second 0.94× Redis, fsync each write 0.94× ← Kafka, OS writeback better the others better →
Each configuration's median against Kafka on the page cache, its default, on the same measure, log scale; above 1× it is better (more messages a second, lower latency or less disk). Median of 10 process runs.
Factor against Kafka, OS writeback per measure, above 1 is better. Messages/s, 100 B: Kafka, fsync each write 0.07×, NATS, fsync every 2 min 0.13×, NATS, fsync each write 0.0009×, RabbitMQ, classic queue 0.062×, RabbitMQ, quorum queue 0.042×, Redis, fsync every second 0.30×, Redis, fsync each write 0.068×. Messages/s, 1 KiB: Kafka, fsync each write 0.085×, NATS, fsync every 2 min 0.13×, NATS, fsync each write 0.0011×, RabbitMQ, classic queue 0.067×, RabbitMQ, quorum queue 0.047×, Redis, fsync every second 0.23×, Redis, fsync each write 0.016×. Messages/s, 10 KiB: Kafka, fsync each write 0.23×, NATS, fsync every 2 min 0.34×, NATS, fsync each write 0.0072×, RabbitMQ, classic queue 0.31×, RabbitMQ, quorum queue 0.18×, Redis, fsync every second 0.33×, Redis, fsync each write 0.033×. Latency p50 at 10k msg/s: Kafka, fsync each write 0.0067×, NATS, fsync every 2 min 1.5×, NATS, fsync each write not sustained, RabbitMQ, classic queue 1.1×, RabbitMQ, quorum queue 0.042×, Redis, fsync every second 2.4×, Redis, fsync each write 0.046×. Latency p99 at 10k msg/s: Kafka, fsync each write 0.012×, NATS, fsync every 2 min 2.2×, NATS, fsync each write not sustained, RabbitMQ, classic queue 1.1×, RabbitMQ, quorum queue 0.024×, Redis, fsync every second 1.7×, Redis, fsync each write 0.051×. Latency p50 at 50k msg/s: Kafka, fsync each write 0.0089×, NATS, fsync every 2 min 2.3×, NATS, fsync each write not sustained, RabbitMQ, classic queue 0.86×, RabbitMQ, quorum queue 0.042×, Redis, fsync every second 3.8×, Redis, fsync each write not sustained. Disk per stored 100 B message: Kafka, fsync each write 1.00×, NATS, fsync every 2 min 0.75×, NATS, fsync each write 0.75×, RabbitMQ, classic queue 0.36×, RabbitMQ, quorum queue 0.31×, Redis, fsync every second 0.62×, Redis, fsync each write 0.63×. Disk per stored 1 KiB message: Kafka, fsync each write 1.00×, NATS, fsync every 2 min 0.97×, NATS, fsync each write 0.97×, RabbitMQ, classic queue 0.84×, RabbitMQ, quorum queue 0.80×, Redis, fsync every second 0.94×, Redis, fsync each write 0.94×. Against Kafka, OS writeback, 8 measures: NATS, fsync every 2 min better on 2 · RabbitMQ, classic queue on 1 · Redis, fsync every second on 2; never better: Kafka, fsync each write · NATS, fsync each write · RabbitMQ, quorum queue · Redis, fsync each write Medians of 10 process runs · log scale · above 1× is better than Kafka, OS writeback fsync before the acknowledgement fsync later, in the background 0.001× 0.01× 0.1× 1× (parity) Messages/s, 100 B Kafka, fsync each write 0.07× NATS, fsync every 2 min 0.13× NATS, fsync each write 0.0009× RabbitMQ, classic queue 0.062× RabbitMQ, quorum queue 0.042× Redis, fsync every second 0.30× Redis, fsync each write 0.068× Messages/s, 1 KiB Kafka, fsync each write 0.085× NATS, fsync every 2 min 0.13× NATS, fsync each write 0.0011× RabbitMQ, classic queue 0.067× RabbitMQ, quorum queue 0.047× Redis, fsync every second 0.23× Redis, fsync each write 0.016× Messages/s, 10 KiB Kafka, fsync each write 0.23× NATS, fsync every 2 min 0.34× NATS, fsync each write 0.0072× RabbitMQ, classic queue 0.31× RabbitMQ, quorum queue 0.18× Redis, fsync every second 0.33× Redis, fsync each write 0.033× p50 at 10k msg/s Kafka, fsync each write 0.0067× NATS, fsync every 2 min 1.5× NATS, fsync each write not sustained RabbitMQ, classic queue 1.1× RabbitMQ, quorum queue 0.042× Redis, fsync every second 2.4× Redis, fsync each write 0.046× p99 at 10k msg/s Kafka, fsync each write 0.012× NATS, fsync every 2 min 2.2× NATS, fsync each write not sustained RabbitMQ, classic queue 1.1× RabbitMQ, quorum queue 0.024× Redis, fsync every second 1.7× Redis, fsync each write 0.051× p50 at 50k msg/s Kafka, fsync each write 0.0089× NATS, fsync every 2 min 2.3× NATS, fsync each write not sustained RabbitMQ, classic queue 0.86× RabbitMQ, quorum queue 0.042× Redis, fsync every second 3.8× Redis, fsync each write not sustained Disk per 100 B message Kafka, fsync each write same NATS, fsync every 2 min 0.75× NATS, fsync each write 0.75× RabbitMQ, classic queue 0.36× RabbitMQ, quorum queue 0.31× Redis, fsync every second 0.62× Redis, fsync each write 0.63× Disk per 1 KiB message Kafka, fsync each write same NATS, fsync every 2 min 0.97× NATS, fsync each write 0.97× RabbitMQ, classic queue 0.84× RabbitMQ, quorum queue 0.80× Redis, fsync every second 0.94× Redis, fsync each write 0.94× ← Kafka, OS writeback better the others better →
Each configuration's median against Kafka on the page cache, its default, on the same measure, log scale; above 1× it is better (more messages a second, lower latency or less disk). Median of 10 process runs.

Maximum throughput

One producer sends as fast as its 1,000-message window allows for 3 seconds while one consumer reads; the rate is messages delivered per second.

Maximum delivered messages per second, 1 KiB messages, one producer and one consumer, log scale: Kafka, OS writeback 1,961,030, Redis, no persistence 650,655, Redis, fsync every second 443,840, NATS, memory stream 298,644, NATS, fsync every 2 min 250,035, Kafka, fsync each write 167,557, RabbitMQ classic queue 132,198, RabbitMQ quorum queue 91,755, Redis, fsync each write 31,009, NATS, fsync each write 2,124. 1 KiB messages: from 2.1k to 1.96M a second. Within one broker the fsync setting alone moves the rate 12× (Kafka), 21× (Redis), 141× (NATS) Messages delivered per second, one producer, one consumer · log scale: each gridline is 10× the previous one fsync before the acknowledgement fsync later, in the background memory only 1k 10k 100k 1M 10M msg/s Kafka OS writeback 1.96M fsync each write 168k NATS JetStream memory stream 299k fsync every 2 min 250k fsync each write 2.1k RabbitMQ classic queue 132k quorum queue 92k Redis Streams no persistence 651k fsync every second 444k fsync each write 31k With an fsync before every acknowledgement the fastest here is Kafka, fsync each write at 168k a second: it fsyncs many messages at once. NATS fsyncs them one at a time.
One producer sending as fast as 1,000 unacknowledged messages allow for 3 s, one consumer reading; messages delivered per second, median of 10 runs. Log scale. Every broker on the same 4 cores. The table below has 100 B and 10 KiB and the min–max.
Maximum delivered messages per second, 1 KiB messages, one producer and one consumer, log scale: Kafka, OS writeback 1,961,030, Redis, no persistence 650,655, Redis, fsync every second 443,840, NATS, memory stream 298,644, NATS, fsync every 2 min 250,035, Kafka, fsync each write 167,557, RabbitMQ classic queue 132,198, RabbitMQ quorum queue 91,755, Redis, fsync each write 31,009, NATS, fsync each write 2,124. 1 KiB messages: from 2.1k to 1.96M a second. Within one broker the fsync setting alone moves the rate 12× (Kafka), 21× (Redis), 141× (NATS) Messages delivered per second, one producer, one consumer · log scale: each gridline is 10× the previous one fsync before the acknowledgement fsync later, in the background memory only 1k 10k 100k 1M 10M msg/s Kafka OS writeback 1.96M fsync each write 168k NATS JetStream memory stream 299k fsync every 2 min 250k fsync each write 2.1k RabbitMQ classic queue 132k quorum queue 92k Redis Streams no persistence 651k fsync every second 444k fsync each write 31k With an fsync before every acknowledgement the fastest here is Kafka, fsync each write at 168k a second: it fsyncs many messages at once. NATS fsyncs them one at a time.
One producer sending as fast as 1,000 unacknowledged messages allow for 3 s, one consumer reading; messages delivered per second, median of 10 runs. Log scale. Every broker on the same 4 cores. The table below has 100 B and 10 KiB and the min–max.
Config100 B1 KiB10 KiB1 KiB in MB/s
Kafka, fsync each write171k
150k–186k
168k
151k–175k
64k
34k–64k
172
Kafka, OS writeback2.46M
2.36M–2.48M
1.96M
1.82M–2.05M
274k
206k–299k
2,008
NATS, fsync each write2.2k
268–2.3k
2.1k
537–2.2k
2.0k
356–2.0k
2
NATS, fsync every 2 min326k
323k–332k
250k
248k–254k
92k
90k–95k
256
NATS, memory stream348k
345k–351k
299k
293k–302k
145k
142k–148k
306
RabbitMQ quorum queue104k
99k–106k
92k
81k–92k
50k
16k–55k
94
RabbitMQ classic queue153k
146k–160k
132k
130k–135k
86k
85k–87k
135
Redis, fsync each write167k
39k–177k
31k
28k–32k
9.0k
4.0k–9.1k
32
Redis, fsync every second735k
657k–744k
444k
369k–451k
89k
64k–106k
454
Redis, no persistence954k
946k–957k
651k
643k–656k
175k
170k–178k
666

Inside one broker, the durability level alone moves throughput by an order of magnitude. Kafka delivers 1.96 M 1 KiB messages a second when it leaves writing to the OS, and 168k when it fsyncs every append; Redis goes from 651k with no persistence to 31k with appendfsync always. Comparing Kafka on the page cache with Redis fsyncing every write would put a 63× gap on the brokers that is really a gap between settings.

What separates the fsync-before-ack configurations is how many messages share one fsync:

Latency at a fixed rate

Throughput at saturation says little about latency at a normal load. Here the publisher follows a fixed schedule, 10,000 and then 50,000 1 KiB messages a second for 5 seconds, and each message’s latency runs from the moment it was scheduled to be sent until the consumer has it, so a publisher held back by a full window counts as late instead of quietly slowing down.

End-to-end latency at 10,000 messages per second, 1 KiB: Redis, no persistence p50 14 µs, p99 35 µs; Redis, fsync every second p50 15 µs, p99 55 µs; NATS, memory stream p50 23 µs, p99 39 µs; NATS, fsync every 2 min p50 25 µs, p99 43 µs; RabbitMQ classic queue p50 33 µs, p99 83 µs; Kafka, OS writeback p50 36 µs, p99 94 µs; Redis, fsync each write p50 774 µs, p99 1.83 ms; RabbitMQ quorum queue p50 861 µs, p99 3.92 ms; Kafka, fsync each write p50 5.36 ms, p99 8.03 ms. Not sustained: NATS, fsync each write. At 10k messages a second, 3 configurations deliver only after their fsync, in 774 µs–5.36 ms; the other 6 deliver in 14–36 µs; NATS, fsync each write cannot keep up 1 KiB messages, publish to delivery · bar: median, tick: 99th percentile · log scale fsync before the acknowledgement fsync later, in the background memory only 0.01 0.1 1 10 100 1,000 ms Kafka OS writeback 36 µs · p99 94 µs fsync each write 5.36 ms · p99 8.03 ms · 2 of 10 runs 75.5–123 ms NATS JetStream memory stream 23 µs · p99 39 µs fsync every 2 min 25 µs · p99 43 µs fsync each write fell behind the schedule: 2.2k msg/s delivered RabbitMQ classic queue 33 µs · p99 83 µs quorum queue 861 µs · p99 3.92 ms · 3 of 10 runs 32.5–68.7 ms Redis Streams no persistence 14 µs · p99 35 µs fsync every second 15 µs · p99 55 µs fsync each write 774 µs · p99 1.83 ms · 1 of 10 runs 160 ms The consumer waits for the fsync only where the broker delivers after it: Kafka, Redis and RabbitMQ quorum queues. A RabbitMQ classic queue hands the message on first and confirms to the producer once it is persisted.
Publisher on a fixed schedule of 10,000 messages per second for 5 s; latency from the scheduled send time to the consumer, so a publisher held back by the broker counts as late. Bar: median; tick: 99th percentile; each the median of 10 runs. Log scale. Runs whose median was more than twice the reported one are noted. The table has the min–max and 50,000 messages per second.
End-to-end latency at 10,000 messages per second, 1 KiB: Redis, no persistence p50 14 µs, p99 35 µs; Redis, fsync every second p50 15 µs, p99 55 µs; NATS, memory stream p50 23 µs, p99 39 µs; NATS, fsync every 2 min p50 25 µs, p99 43 µs; RabbitMQ classic queue p50 33 µs, p99 83 µs; Kafka, OS writeback p50 36 µs, p99 94 µs; Redis, fsync each write p50 774 µs, p99 1.83 ms; RabbitMQ quorum queue p50 861 µs, p99 3.92 ms; Kafka, fsync each write p50 5.36 ms, p99 8.03 ms. Not sustained: NATS, fsync each write. At 10k messages a second, 3 configurations deliver only after their fsync, in 774 µs–5.36 ms; the other 6 deliver in 14–36 µs; NATS, fsync each write cannot keep up 1 KiB messages, publish to delivery · bar: median, tick: 99th percentile · log scale fsync before the acknowledgement fsync later, in the background memory only 0.01 0.1 1 10 100 1,000 ms Kafka OS writeback 36 µs · p99 94 µs fsync each write 5.36 ms · p99 8.03 ms 2 of 10 runs 75.5–123 ms NATS JetStream memory stream 23 µs · p99 39 µs fsync every 2 min 25 µs · p99 43 µs fsync each write fell behind the schedule: 2.2k msg/s delivered RabbitMQ classic queue 33 µs · p99 83 µs quorum queue 861 µs · p99 3.92 ms 3 of 10 runs 32.5–68.7 ms Redis Streams no persistence 14 µs · p99 35 µs fsync every second 15 µs · p99 55 µs fsync each write 774 µs · p99 1.83 ms 1 of 10 runs 160 ms The consumer waits for the fsync only where the broker delivers after it: Kafka, Redis and RabbitMQ quorum queues. A RabbitMQ classic queue hands the message on first and confirms to the producer once it is persisted.
Publisher on a fixed schedule of 10,000 messages per second for 5 s; latency from the scheduled send time to the consumer, so a publisher held back by the broker counts as late. Bar: median; tick: 99th percentile; each the median of 10 runs. Log scale. Runs whose median was more than twice the reported one are noted. The table has the min–max and 50,000 messages per second.
Config10k msg/s p50p99p99.950k msg/s p50p99p99.9
Kafka, fsync each write5.36 ms
5.20 ms–123 ms
kept up in 7 of 10 runs
8.03 ms11.4 ms5.47 ms
5.40 ms–307 ms
kept up in 7 of 10 runs
8.25 ms11.7 ms
Kafka, OS writeback36 µs
35 µs–37 µs
94 µs1.83 ms49 µs
48 µs–50 µs
204 µs2.04 ms
NATS, fsync each writenot sustained
2.2k msg/s delivered
––not sustained
2.2k msg/s delivered
––
NATS, fsync every 2 min25 µs
24 µs–25 µs
43 µs258 µs21 µs
21 µs–21 µs
167 µs1.27 ms
NATS, memory stream23 µs
23 µs–23 µs
39 µs70 µs20 µs
19 µs–20 µs
63 µs151 µs
RabbitMQ quorum queue861 µs
832 µs–68.7 ms
3.92 ms13.9 ms1.15 ms
1.12 ms–658 ms
kept up in 9 of 10 runs
23.8 ms43.2 ms
RabbitMQ classic queue33 µs
31 µs–33 µs
83 µs137 µs57 µs
55 µs–60 µs
203 µs402 µs
Redis, fsync each write774 µs
763 µs–160 ms
kept up in 8 of 10 runs
1.83 ms6.10 msnot sustained
31k msg/s delivered
––
Redis, fsync every second15 µs
14 µs–15 µs
55 µs17.5 ms13 µs
13 µs–13 µs
62 µs381 µs
Redis, no persistence14 µs
14 µs–14 µs
35 µs6.98 ms12 µs
12 µs–12 µs
55 µs250 µs

The fsync shows up in a consumer’s latency only where the broker hands a message to consumers after syncing it. Kafka exposes a message to readers once it is appended, and with flush.messages=1 the fsync is part of the append: 5.36 ms at the median, against 36 µs on the page cache. Redis writes its replies, XREAD included, only after the event loop’s fsync: 774 µs against 15 µs. A quorum queue delivers once its log entry is committed, which includes the fsync: 861 µs. A RabbitMQ classic queue, by contrast, passes the message to a waiting consumer straight away and confirms to the producer only once it is persisted: 33 µs end to end, the same as the brokers that never fsync. Its durability cost lands on the publisher’s confirm, which this test does not time.

The medians hide a spread between runs, and the SSD shared with other workloads is the likely reason: a quorum queue’s run medians ranged from 832 µs to 68.7 ms, and Kafka fsyncing each append kept its schedule in 7 of 10 runs at 10,000 a second. The table carries the min–max of every median.

A configuration counts as not sustained when the publisher falls a second behind its schedule, or latency keeps growing through the run (the median of the last fifth more than twice the first half’s plus 10 ms). Its percentiles would then measure a growing queue, not the broker, so the table shows the rate it did deliver instead.

Fan-out: one producer, many consumers

Every consumer receives every message: 1, 4 or 16 of them, 1 KiB messages, the producer again at full speed. Kafka’s consumers each read the one partition independently, NATS’s are ordered consumers on the stream, Redis’s each run their own XREAD; RabbitMQ has no shared log in these queue types, so a fanout exchange copies every message into one queue per consumer. Shown for the default durability of each broker plus both RabbitMQ queue types:

Messages per second each consumer receives with 1, 4 and 16 consumers, 1 KiB: Kafka, OS writeback 1,961,030, 1,681,030, 783,301; NATS, fsync every 2 min 250,035, 167,391, 69,088; RabbitMQ quorum queue 91,755, 39,829, 10,419; RabbitMQ classic queue 132,198, 47,684, 10,463; Redis, fsync every second 443,840, 319,680, 148,971. With 16 consumers each one still gets 783k messages a second from Kafka's single log; RabbitMQ, which stores one copy per queue, delivers about 10k from either queue type Messages per second each consumer receives, 1 KiB · rows: 1, 4, 16 consumers · log scale fsync before the acknowledgement fsync later, in the background 1k 10k 100k 1M 10M msg/s Kafka OS writeback · 1 consumer 1.96M 4 consumers 1.68M 16 consumers 783k NATS JetStream fsync every 2 min · 1 consumer 250k 4 consumers 167k 16 consumers 69k RabbitMQ classic queue · 1 consumer 132k 4 consumers 48k 16 consumers 10k quorum queue · 1 consumer 92k 4 consumers 40k 16 consumers 10k Redis Streams fsync every second · 1 consumer 444k 4 consumers 320k 16 consumers 149k A log (Kafka, NATS, Redis) is read by every consumer from the same stored copy; RabbitMQ's fanout writes one copy per queue.
One producer at full speed for 3 s, every consumer receives every message (Kafka: independent readers of one partition; NATS: ordered consumers; RabbitMQ: a fanout exchange with one queue per consumer; Redis: XREAD per consumer). Rate of the slowest consumer, median of 10 runs.
Messages per second each consumer receives with 1, 4 and 16 consumers, 1 KiB: Kafka, OS writeback 1,961,030, 1,681,030, 783,301; NATS, fsync every 2 min 250,035, 167,391, 69,088; RabbitMQ quorum queue 91,755, 39,829, 10,419; RabbitMQ classic queue 132,198, 47,684, 10,463; Redis, fsync every second 443,840, 319,680, 148,971. With 16 consumers each one still gets 783k messages a second from Kafka's single log; RabbitMQ, which stores one copy per queue, delivers about 10k from either queue type Messages per second each consumer receives, 1 KiB · rows: 1, 4, 16 consumers · log scale fsync before the acknowledgement fsync later, in the background 1k 10k 100k 1M 10M msg/s Kafka OS writeback · 1 consumer 1.96M 4 consumers 1.68M 16 consumers 783k NATS JetStream fsync every 2 min · 1 consumer 250k 4 consumers 167k 16 consumers 69k RabbitMQ classic queue · 1 consumer 132k 4 consumers 48k 16 consumers 10k quorum queue · 1 consumer 92k 4 consumers 40k 16 consumers 10k Redis Streams fsync every second · 1 consumer 444k 4 consumers 320k 16 consumers 149k A log (Kafka, NATS, Redis) is read by every consumer from the same stored copy; RabbitMQ's fanout writes one copy per queue.
One producer at full speed for 3 s, every consumer receives every message (Kafka: independent readers of one partition; NATS: ordered consumers; RabbitMQ: a fanout exchange with one queue per consumer; Redis: XREAD per consumer). Rate of the slowest consumer, median of 10 runs.

The log-based brokers store a message once and hand the same bytes to every reader: Kafka still gives each of 16 consumers 783k messages a second, 12.53 M deliveries in total. RabbitMQ’s fanout writes, and fsyncs, one copy per queue: with 16 consumers its quorum queues deliver 10k a second to each.

Disk and memory per stored message

A broker holding a backlog, the consumer offline, pays in disk and memory for every message. Each run publishes up to 50,000 messages with no consumer to a fresh broker (the slowest configuration, NATS fsyncing every message, stops after 10 seconds at about 21,000), waits 2 seconds for background writes, and compares the data directory and the broker’s memory with the moment before.

Broker cost per stored 100 B message: Kafka, fsync each write disk 110 B, memory 539 B; Kafka, OS writeback disk 110 B, memory 525 B; NATS, fsync each write disk 147 B, memory 603 B; NATS, fsync every 2 min disk 147 B, memory 555 B; NATS, memory stream disk 0 B, memory 505 B; RabbitMQ quorum queue disk 359 B, memory 800 B; RabbitMQ classic queue disk 308 B, memory 444 B; Redis, fsync each write disk 177 B, memory 120 B; Redis, fsync every second disk 177 B, memory 157 B; Redis, no persistence disk 0 B, memory 118 B. A stored 100 B message takes 110 B of disk on Kafka and 359 B on a quorum queue; held in memory only, 118 B (Redis) to 505 B (NATS) Bytes per stored 100 B message, a backlog with no consumer · linear scale disk broker memory, no disk Kafka OS writeback 110 B fsync each write 110 B NATS JetStream memory stream 505 B of memory fsync every 2 min 147 B fsync each write 147 B RabbitMQ classic queue 308 B quorum queue 359 B Redis Streams no persistence 118 B of memory fsync every second 177 B fsync each write 177 B payload, 100 B Small messages pay mostly for the broker's own framing and indexes; at 10 KiB every broker stores close to the payload.
20,788–50,000 messages published with no consumer to a fresh broker, then 2 s for background writes. Disk: allocated blocks in the data directory, after minus before, per message; for the memory-only configurations the broker's anonymous memory instead. Median of 10 runs; min to max across the runs is within 11 % of the median for every bar drawn. The table below has 1 KiB and 10 KiB and every configuration's memory, which is noisy for the brokers that keep messages in files.
Broker cost per stored 100 B message: Kafka, fsync each write disk 110 B, memory 539 B; Kafka, OS writeback disk 110 B, memory 525 B; NATS, fsync each write disk 147 B, memory 603 B; NATS, fsync every 2 min disk 147 B, memory 555 B; NATS, memory stream disk 0 B, memory 505 B; RabbitMQ quorum queue disk 359 B, memory 800 B; RabbitMQ classic queue disk 308 B, memory 444 B; Redis, fsync each write disk 177 B, memory 120 B; Redis, fsync every second disk 177 B, memory 157 B; Redis, no persistence disk 0 B, memory 118 B. A stored 100 B message takes 110 B of disk on Kafka and 359 B on a quorum queue; held in memory only, 118 B (Redis) to 505 B (NATS) Bytes per stored 100 B message, a backlog with no consumer · linear scale disk broker memory, no disk Kafka OS writeback 110 B fsync each write 110 B NATS JetStream memory stream 505 B of memory fsync every 2 min 147 B fsync each write 147 B RabbitMQ classic queue 308 B quorum queue 359 B Redis Streams no persistence 118 B of memory fsync every second 177 B fsync each write 177 B payload, 100 B Small messages pay mostly for the broker's own framing and indexes; at 10 KiB every broker stores close to the payload.
20,788–50,000 messages published with no consumer to a fresh broker, then 2 s for background writes. Disk: allocated blocks in the data directory, after minus before, per message; for the memory-only configurations the broker's anonymous memory instead. Median of 10 runs; min to max across the runs is within 11 % of the median for every bar drawn. The table below has 1 KiB and 10 KiB and every configuration's memory, which is noisy for the brokers that keep messages in files.
Config100 B disk100 B memory1 KiB disk1 KiB memory10 KiB disk10 KiB memory
Kafka, fsync each write110 B539 B
533 B–543 B
1,034 B1,025 B
968 B–1,353 B
10.3 KB7,002 B
6,653 B–7,110 B
Kafka, OS writeback110 B525 B
517 B–714 B
1,034 B956 B
741 B–1,020 B
10.3 KB6,980 B
6,965 B–7,183 B
NATS, fsync each write147 B603 B
519 B–1,374 B
1,072 B1,123 B
1,041 B–4,418 B
10.3 KB1,735 B
1,130 B–6,965 B
NATS, fsync every 2 min147 B555 B
546 B–582 B
1,071 B468 B
436 B–495 B
10.3 KB571 B
408 B–698 B
NATS, memory stream0 B505 B
480 B–533 B
0 B1,679 B
1,612 B–1,817 B
0 B12.8 KB
12.6 KB–13.8 KB
RabbitMQ quorum queue359 B800 B
655 B–907 B
1,286 B1,738 B
1,663 B–1,945 B
10.5 KB5,133 B
1,645 B–12.0 KB
RabbitMQ classic queue308 B444 B
103 B–783 B
1,232 B497 B
74 B–818 B
10.5 KB597 B
300 B–900 B
Redis, fsync each write177 B120 B
120 B–121 B
1,101 B1,211 B
1,211 B–1,211 B
10.3 KB12.5 KB
12.5 KB–12.5 KB
Redis, fsync every second177 B157 B
119 B–165 B
1,102 B1,349 B
1,210 B–1,473 B
10.3 KB12.5 KB
12.5 KB–12.8 KB
Redis, no persistence0 B118 B
118 B–119 B
0 B1,207 B
1,207 B–1,207 B
0 B12.5 KB
12.5 KB–12.5 KB

Disk is the payload plus each broker’s per-message framing: Kafka’s record batch headers and offset index (10 B above the payload at 100 B), NATS’s message headers with the subject (47 B), Redis’s AOF, which logs the XADD command itself (77 B), and RabbitMQ’s queue segment plus its write-ahead log (259 B for a quorum queue).

Memory is the broker’s own (anonymous) memory, not the page cache. Kafka and NATS on disk keep messages in files and let the kernel cache them, so their numbers are mostly heap and index growth, and noisy (the table carries each cell’s min–max): a garbage collector or allocator decides when memory is returned. The memory-only configurations hold everything themselves: 1,207 B per 1 KiB message in Redis, 1,679 B in a NATS memory stream.

Recovery after kill -9

The durability table is the brokers’ documentation. This part is measured: a publisher sends 1 KiB messages at 20,000 a second and records which ones the broker acknowledged; about one second in, the broker’s container is killed with SIGKILL, then started again on the same data directory, and a consumer reads back everything that survived.

Acknowledged messages lost when the broker is killed with SIGKILL and restarted: Kafka, fsync each write 0.0 % (0 of 199,987); Kafka, OS writeback 0.0 % (0 of 218,218); NATS, fsync each write 0.0 % (0 of 17,496); NATS, fsync every 2 min 0.0 % (0 of 214,311); NATS, memory stream 100.0 % (214,567 of 214,567); RabbitMQ quorum queue 0.0 % (0 of 204,193); RabbitMQ classic queue 0.0 % (0 of 213,650); Redis, fsync each write 0.0 % (0 of 183,398); Redis, fsync every second 0.0 % (0 of 216,459); Redis, no persistence 100.0 % (215,186 of 215,186). kill -9: 8 of 10 configurations lost no acknowledged message, including every one that fsyncs only in the background Share of acknowledged messages missing after the restart, all runs together Kafka, fsync each write 0 of 199,987 lost Kafka, OS writeback 0 of 218,218 lost NATS, fsync each write 0 of 17,496 lost NATS, fsync every 2 min 0 of 214,311 lost NATS, memory stream all 214,567 lost RabbitMQ quorum queue 0 of 204,193 lost RabbitMQ classic queue 0 of 213,650 lost Redis, fsync each write 0 of 183,398 lost Redis, fsync every second 0 of 216,459 lost Redis, no persistence all 215,186 lost A process crash leaves the page cache alone: whatever the broker had handed to the kernel survives, fsync or not. Memory-only configurations lose everything.
Publisher at 20,000 messages per second (1 KiB); the broker container is killed with SIGKILL about 1 s in and restarted on the same data directory; a consumer then reads everything back. Lost: acknowledged messages that are gone, summed over 10 runs. The kernel and its page cache stay up, so this is a process crash, not a power cut.
Acknowledged messages lost when the broker is killed with SIGKILL and restarted: Kafka, fsync each write 0.0 % (0 of 199,987); Kafka, OS writeback 0.0 % (0 of 218,218); NATS, fsync each write 0.0 % (0 of 17,496); NATS, fsync every 2 min 0.0 % (0 of 214,311); NATS, memory stream 100.0 % (214,567 of 214,567); RabbitMQ quorum queue 0.0 % (0 of 204,193); RabbitMQ classic queue 0.0 % (0 of 213,650); Redis, fsync each write 0.0 % (0 of 183,398); Redis, fsync every second 0.0 % (0 of 216,459); Redis, no persistence 100.0 % (215,186 of 215,186). kill -9: 8 of 10 configurations lost no acknowledged message, including every one that fsyncs only in the background Share of acknowledged messages missing after the restart, all runs together Kafka, fsync each write 0 of 200k lost Kafka, OS writeback 0 of 218k lost NATS, fsync each write 0 of 17k lost NATS, fsync every 2 min 0 of 214k lost NATS, memory stream all 215k lost RabbitMQ quorum queue 0 of 204k lost RabbitMQ classic queue 0 of 214k lost Redis, fsync each write 0 of 183k lost Redis, fsync every second 0 of 216k lost Redis, no persistence all 215k lost A process crash leaves the page cache alone: whatever the broker had handed to the kernel survives, fsync or not. Memory-only configurations lose everything.
Publisher at 20,000 messages per second (1 KiB); the broker container is killed with SIGKILL about 1 s in and restarted on the same data directory; a consumer then reads everything back. Lost: acknowledged messages that are gone, summed over 10 runs. The kernel and its page cache stay up, so this is a process crash, not a power cut.
ConfigAcknowledged before the killLost after restartRuns with loss
Kafka, fsync each write20,4220
0–0
0 of 10
Kafka, OS writeback21,5080
0–0
0 of 10
NATS, fsync each write2,0030
0–0
0 of 10
NATS, fsync every 2 min21,4410
0–0
0 of 10
NATS, memory stream21,48921,489
21,157–21,605
10 of 10
RabbitMQ quorum queue21,1820
0–0
0 of 10
RabbitMQ classic queue21,3680
0–0
0 of 10
Redis, fsync each write21,2690
0–0
0 of 10
Redis, fsync every second21,5640
0–0
0 of 10
Redis, no persistence21,52221,522
21,258–21,922
10 of 10

No configuration that writes to disk lost an acknowledged message, including the ones that fsync only in the background: Kafka on the page cache, NATS with its 2-minute sync, Redis with everysec. That is not luck. kill -9 ends the process, not the machine: whatever the broker had already handed to the kernel with write() sits in the page cache and reaches the disk later anyway. Every one of these brokers writes before it acknowledges; they differ in when they fsync, and fsync only matters if the kernel itself goes down. The memory-only configurations lost all 215,186 (Redis) and 214,567 (NATS) acknowledged messages, as they must.

Some messages the broker never acknowledged survived as well (5,020 across all runs): they were stored, but the acknowledgement died with the process. A producer that retries those will write them twice, which is why Kafka’s idempotent producer and NATS’s message deduplication exist.

So what does fsync-before-ack buy on one node? Protection against a kernel crash or a power cut, where the page cache is lost. This benchmark did not cut power, so it cannot say how much a background-fsync broker loses then; the 10 runs only show that a process crash costs none of them anything.

What this does not show

What the numbers say

Reproduce it

The harness is one Go program with the four client libraries, two shell scripts that start the client container and one broker per durability configuration, and a driver script:

docker build -t brb .                       # Go 1.26 build, runs a self-test of the payload checks
./net.sh 4-7                                # client container on cores 4-7; brokers join its network
./broker.sh kafka-sync 0-3                  # empty data dir, Kafka with flush.messages=1 topics, cores 0-3
docker exec bk-net bb ready -broker kafka -cfg kafka-sync
docker exec bk-net bb thr -broker kafka -cfg kafka-sync -size 1024 -dur 3s
docker exec bk-net bb lat -broker kafka -cfg kafka-sync -size 1024 -rate 10000 -dur 5s

Each run prints one JSON line: messages sent, acknowledged and received per consumer, duplicated, corrupted and missing, the rates, and for latency runs the percentiles and whether the schedule was kept.

Questions? Let's Chat :)

protocols