BullMQ on Bun — Choosing a Redis Client Adapter
In a previous article we showed that running BullMQ on Bun gives a nice performance bump over Node.js for most workloads. That article used ioredis, which has been the long-standing default Redis client for BullMQ up until now.
Since then, BullMQ has gained two additional Redis client adapters:
- node-redis — the official
@redis/clientpackage from Redis Inc. - bun-native — a thin adapter over Bun's built-in
Bun.RedisClient.
bun-native removes the Node.js compatibility layer and talks to Redis directly through Bun's
native runtime, so you would expect it to be the fastest option when running on Bun. In practice
it is competitive for most workloads but never clearly faster, and there is one case where it is
meaningfully slower. Its main advantage is that it requires no extra dependency — it is built
into Bun itself. Below are the numbers, followed by a detailed explanation of the gap.
I am running everything on the same MacBook Pro (M2 Pro, 16 GB) against a local Redis server, Bun 1.3.14, and BullMQ v5.77.6. The benchmark code is available at bullmq-bun-bench so you can reproduce the numbers yourself.
TL;DR
On the Bun runtime, BullMQ's three Redis client adapters (ioredis, node-redis,
bun-native) perform within noise of each other for adding jobs, bulk-adding jobs, and
processing jobs. The biggest gap is FlowProducer, where bun-native is roughly
47% slower than the other two. The reason as far as I understand is that Bun.RedisClient has no batch
API, so each MULTI/EXEC transaction issues one send() call per command instead of a
single buffered write, resulting in a ~19× slowdown on the transaction framing alone.
It is not Bun's runtime's fault (ioredis and node-redis both run on Bun at full speed
in our tests), and the gap is not a RESP3 vs RESP2 artefact either (forcing node-redis
onto RESP3 changes nothing). The main advantage of bun-native is zero extra dependencies —
it is built into the Bun runtime. For flow-heavy workloads, prefer ioredis or node-redis;
for everything else bun-native works fine. Hopefully the Bun team will improve the redis
client over time and this gap will disappear.
Note: these benchmarks were run on macOS (M2 Pro). Results on Linux may differ.
Benchmark Configuration
- Runtime: Bun 1.3.14
- Jobs per test: 50,000
- Worker concurrency: 100
- Redis: Local server, default config
- Results: Best of 3 runs
End-to-End Results
Job Addition (Queue.add)
Adding 50,000 jobs individually with Queue.add(), 1,000 in parallel:
All three adapters land in the same ballpark — within ~9% of each other. ioredis edges out a small lead, likely because of its auto-pipelining optimization, which batches commands queued inside the same event-loop tick into a single socket write.
Bulk Job Addition (Queue.addBulk)
Very close, with bun-native taking a slight lead. With addBulk the BullMQ pipeline is already
explicitly batched, so the adapter has little room to differentiate itself.
Job Processing
Essentially identical. Worker throughput is dominated by Redis round-trip latency and the BullMQ state-machine overhead, not the client adapter.
Job Processing with CPU Work
Each job runs a recursive fib(20) in addition to the Redis bookkeeping:
node-redis shows a clear edge here (~23% over bun-native). bun-native is the slowest of the three on this test, which is surprising given that Bun generally excels at compute. The gap is consistent across runs.
Flow Producer
This is where the picture changes. Each "flow" creates one parent job and two children
(16,666 flows = 49,998 jobs). Each call to FlowProducer.add() issues a Redis MULTI/EXEC
transaction containing several EVALSHA invocations:
bun-native is ~47% slower than node-redis for flow creation. Same runtime, same
machine, same Redis server, same BullMQ version — only the Redis client adapter changes. So what
is going on?
Why is bun-native slow at MULTI/EXEC?
That gap is large enough that it deserves a proper explanation. Below is a step-by-step reproduction.
Hypothesis
Bun's built-in RedisClient exposes a one-command-at-a-time API:
const client = new Bun.RedisClient();
await client.send("EVALSHA", [sha, "0", "x"]);
There is no public batch or pipeline primitive. Each send() call enters the C++ runtime, gets
serialized to a RESP frame, and is written to the socket. The runtime can coalesce TCP writes,
but the client cannot pack multiple commands into a single buffer the way ioredis and node-redis
do.
For independent commands this does not matter as the runtime pipelines them at the socket level.
But for MULTI/EXEC, ioredis and node-redis both build a single RESP buffer like
MULTI\r\n…\r\nEXEC\r\n and write it in one call, while bun-native has to issue N separate
send() calls. The hypothesis is that this per-call overhead is what we are measuring.
Test 1. Non-transactional pipelining
If bun-native is slow only because of MULTI/EXEC framing, then running the same EVALSHA
commands without wrapping them in MULTI/EXEC should be fast. We measure the throughput of
firing K parallel EVALSHA calls per batch, N=2,000 batches, 5 trials, on the same Bun runtime:
bun-native is the fastest of the three clients for single-command throughput — 368K
EVALSHA per second, 2.7 µs per command. So the client is clearly not slow in general.
Test 2 — The same EVALSHAs, wrapped in MULTI/EXEC
Now we run the exact same commands again, but each batch is wrapped in MULTI/EXEC. Everything
else (N, K, runtime, server) is identical:
The collapse is unambiguous. For the FlowProducer-shaped 3-command transaction:
- ioredis goes from 62,885 batches/sec (no MULTI) → 102,482 with MULTI (
+63%, because the protocol bytes are batched into one write). - node-redis goes from 145,485 → 125,092 (
-14%, negligible overhead). - bun-native goes from 144,364 → 18,848 (
-87%, a 7.7× collapse).
For 1× EVALSHA the bun-native cost-per-block goes from 2.7 µs (no MULTI) to 51 µs (with MULTI) — a 19× slowdown for adding the same two framing commands that the other clients handle essentially for free.
What the data shows
The throughput collapses only when MULTI/EXEC is involved and only for bun-native. The
other two clients show flat or improved throughput under the same wrapping because they pack the
whole transaction into a single socket write. bun-native has to make multiple send() calls
per transaction, each crossing the JS↔C++ boundary, and the cumulative overhead dominates.
A small "fixed cost per block" check confirms the picture:
| Transaction size | µs / block (bun-native) | µs / block (ioredis) |
|---|---|---|
| 1× EVALSHA | 51.0 | 11.2 |
| 3× EVALSHA | 53.1 | 9.8 |
| 10× EVALSHA | 71.3 | 19.3 |
bun-native pays roughly 50 µs of fixed overhead per MULTI/EXEC block, regardless of how
many commands are inside. Once you have that number, the FlowProducer gap stops being mysterious.
Reproducing this
The proof harnesses are part of bullmq-bun-bench:
# Wrapped in MULTI/EXEC
bun run multi-exec-proof.ts
# Same commands without MULTI/EXEC
bun run pipelined-proof.ts
Both scripts print median, min, max and stddev over five trials so you can verify the numbers on your own setup.
What this is not
This is not a Bun runtime issue and it is not a JavaScriptCore vs. V8 issue. Both ioredis and
node-redis run on Bun in the test above and both handle MULTI/EXEC at full speed. The gap is
specifically in Bun.RedisClient's lack of a batch API.
A Note on RESP2 vs RESP3
A fair objection: the three clients are not all speaking the same protocol version. The current matrix is:
- ioredis 5.10 — RESP2 only. The library has no
HELLOhandshake orprotocoloption, so there is no way to opt in to RESP3. - node-redis 5 — RESP2 by default, with opt-in RESP3 via
createClient({ RESP: 3 }). - Bun.RedisClient — RESP3 only. There is no way to make it speak RESP2.
RESP3 was designed by Redis Inc. specifically to be faster and more expressive (typed maps and
sets instead of flat arrays, push frames for pub/sub, double precision, etc.). It is fair to ask
whether the gap we measured is partly explained by the protocol difference rather than by the
adapter implementation. So we ran the full BullMQ benchmark suite again with node-redis in both
modes (best of 3 runs, same Bun 1.3.14 runtime):
| Benchmark | node-redis RESP2 | node-redis RESP3 | Difference |
|---|---|---|---|
| Job Addition | 52,301/sec | 52,301/sec | 0% |
| Bulk Addition | 54,113/sec | 55,006/sec | +1.6% |
| Job Processing | 30,941/sec | 30,979/sec | +0.1% |
| CPU Work | 18,083/sec | 18,005/sec | -0.4% |
| Flow Producer | 41,423/sec | 40,848/sec | -1.4% |
Every difference is within run-to-run noise. RESP3 has no measurable effect on BullMQ throughput
with node-redis on this workload.
That result is consistent with what RESP3 actually changes: the response encoding. For BullMQ, the replies returned by our Lua scripts are mostly small arrays of strings or integers, which encode almost identically in both protocols. The wire savings RESP3 can offer (typed maps instead of pair-wise arrays, big-number precision, etc.) simply do not apply here. RESP3's other big feature — push frames for pub/sub — is irrelevant for the queue-add and flow-create paths we are measuring.
To make sure this was not a measurement artefact — i.e. that our RESP3 setup was actually
negotiating RESP3 with the server — we ran a sanity check on a workload where RESP3 should
win: 5,000 parallel HGETALL calls against a 20-field hash. In RESP2 the server returns a flat
[key, value, key, value, …] array that the client has to reassemble into an object; in RESP3
the server returns a typed map that the parser builds directly. Result: RESP2 122,253 ops/sec,
RESP3 133,156 ops/sec — a clean +8.9% for RESP3. So the negotiation works and RESP3 does
help where the protocol's improvements actually apply; it just doesn't apply to BullMQ's
script-based replies. Both proof scripts (proof:resp2-vs-resp3 and proof:resp3-sanity) are
in the bullmq-bun-bench repo.
So the bun-native MULTI/EXEC gap is not a protocol artefact. Forcing node-redis onto the
same RESP3 protocol that bun-native uses does not slow it down, and we already saw that
bun-native is the fastest client on the non-transactional pipelined test, where it is also
using RESP3. The bottleneck is the per-send() overhead inside the bun-native adapter, not
the protocol it speaks.
If Bun were to expose a sendPipeline(commands) or MULTI-aware fast path (similar to ioredis's
multi().exec() which serializes the whole transaction client-side), bun-native would very
likely become the fastest option across the board, given how much it leads the field on the
non-transactional benchmarks above.
Recommendations
- If your workload does not use Flow Producer (or only uses it occasionally) and you want
zero extra dependencies on Bun,
bun-nativeis a reasonable choice. - If your workload is flow-heavy, prefer
ioredisornode-redison Bun — both run fine and pay no MULTI/EXEC tax. - For projects that need to support both Node.js and Bun from the same codebase,
node-redisis the most balanced option: it has the official Redis Inc. backing, the same single-write MULTI/EXEC behaviour as ioredis, and a clear edge on CPU-bound work. ioredisremains the safe default — battle-tested, best auto-pipelining, and fastest for individual job addition.- Regardless of adapter choice, the Bun runtime itself remains a solid choice for BullMQ.
Conclusion
On Bun, the three BullMQ Redis client adapters are within noise of each other for the operations
that dominate most BullMQ workloads: adding jobs (single and bulk) and processing them. The only
workload where the choice meaningfully matters today is FlowProducer.add(), which compiles
down to MULTI/EXEC transactions and exposes a current limitation in Bun.RedisClient's API: no
way to pack multiple commands into a single write.
The good news is that this is a fixable problem upstream — the cost is structural, not algorithmic, and Bun's underlying socket performance is excellent. The bad news is that, until Bun ships a batch primitive, flow-heavy workloads should stick with ioredis or node-redis.
These benchmarks were run locally on macOS (Apple M2 Pro). Production workloads typically run on Linux where the performance characteristics may differ — we plan to follow up with Linux numbers in a future post.
All benchmark code is available at bullmq-bun-bench if you want to reproduce the numbers or run them on your own hardware.