Drop-in replacement for beanstalkd The same work queue.
Rebuilt in Rust.
Byte-for-byte protocol compatible, so existing clients work unmodified. Faster, with TLS, metrics and optional Raft replication built in.
$ cargo install bstkd
- 2.2×
- throughput with a binlog
- 1.2–1.4×
- at 10–100 connections
- 222
- differential test cases
- 3 or 5
- nodes, Raft-replicated
Features
Everything beanstalkd does.
Plus what production needs.
One binary, no runtime dependencies, MIT.
-
Drop-in compatible
Every command, reply and edge case matches the reference, checked by 222 differential tests.
-
Faster, on less CPU
1.2–1.4× the throughput at 10–100 connections, with 10–24% less CPU per operation.
-
TLS and authentication
TLS, mutual TLS and token authentication per listener. No proxy in front.
-
Observable
Prometheus /metrics, /healthz, /readyz and a JSON /admin endpoint.
-
Raft replication
Optional 3 or 5 node cluster over mutual TLS. Keeps serving through the loss of a minority.
-
Graceful shutdown
SIGTERM stops accepting, syncs the log and exits 0.
Performance
Same fsync. 2.2× the throughput.
Operations per second at 100 connections, beanstalkd against beanstalkd-rs. Higher is better.
| Workload | beanstalkd | beanstalkd-rs | Ratio |
|---|---|---|---|
| put-reserve-delete | 516k | 1.31× | |
| 16 pipelined | 643k | 1.31× | |
| producers and consumers | 501k | 1.19× | |
| with a binlog | 594k | 2.22× |
Linux 7.0 (aarch64) on an Apple M6, both servers with default settings, medians of 5 alternated runs. One connection is latency-bound, where beanstalkd-rs is 4% slower on Linux. Every cell, the method and the raw data: docs/BENCH.md.
Compare
beanstalkd-rs and beanstalkd
| Feature | beanstalkd | beanstalkd-rs |
|---|---|---|
| Protocol | the reference | byte for byte |
| Built-in TLS | — | |
| Token and mTLS auth | — | |
| Raft replication | — | |
| Prometheus metrics | — | |
| Graceful SIGTERM | — | |
| Binlog format | the original | a new one, not compatible |
The few intentional behavior differences, each with the test that covers it: docs/COMPAT.md.
FAQ
Before you switch
Do existing beanstalkd clients work with beanstalkd-rs?
Yes, unmodified. beanstalkd-rs speaks the beanstalkd protocol byte for byte, including the reference's parser quirks. The Python greenstalk, Go beanstalk and PHP Pheanstalk clients run the same script against both servers, and the transcripts must be identical.
Does beanstalkd-rs work with Laravel queues?
Yes. Laravel's beanstalkd queue driver uses Pheanstalk, one of the clients compared transcript for transcript against the reference beanstalkd. Point the queue connection at beanstalkd-rs.
Can beanstalkd-rs read an existing beanstalkd binlog?
No. beanstalkd-rs keeps its own on-disk format, a segmented and preallocated write-ahead log, and refuses the other server's directory with bad magic. To migrate, put the old server in drain mode with SIGUSR1, wait for its queues to empty, then start beanstalkd-rs on a new, empty directory. The migration guide has the steps.
What behaves differently from beanstalkd?
Very little. The command line is the same except -u, which is rejected: privilege dropping belongs to the service manager. A binlog write or fsync error stops the server instead of silently disabling the log. A put too large for one log segment replies OUT_OF_MEMORY. Every difference, with the test that covers it, is in docs/COMPAT.md.
Does beanstalkd-rs support replication and failover?
Yes, optionally. Three or five nodes form a Raft cluster over mutual TLS. Clients connect to any node, the cluster keeps serving through the loss of a minority, and nodes can be added, removed or moved while it serves. Without a cluster configuration it runs as a single server, like beanstalkd.
Is beanstalkd-rs ready for production?
Judge it by the testing: 222 differential cases replay the same operations against the C reference and require identical replies, 800+ tests include crash, restart and chaos suites, four decoders are fuzzed, and the workspace forbids unsafe code. The operations guide covers systemd, backups, upgrades and monitoring.
Get started
Up in one command.
$ docker run -d --name bstk -p 127.0.0.1:11300:11300 -v bstk-data:/data \
shonhen/beanstalkd-rs -l 0.0.0.0 -p 11300 -b /data
$ cargo install bstkd # or: cargo binstall bstkd
$ beanstalkd-rs -l 127.0.0.1 -p 11300 -b ./binlog
Linux x86_64 and aarch64 (glibc or static musl) and macOS aarch64. Each archive holds the binary, a systemd unit, example configurations, the cluster certificate script and the operations guide.
linux/amd64 and linux/arm64. Also on ghcr.io/shaunlee/beanstalkd-rs
Rust 1.98 or newer. The binary is called beanstalkd-rs
Installation with systemd, configuration, clusters, backups and upgrades: the operations guide
Migrating from beanstalkd
Point existing clients at it and they work unmodified. The binlog format differs, so drain the old server and switch.
Read the migration guideWhen something else fits better
- Consumer groups or replay: NATS, Kafka, Redis Streams
- No operations at all: SQS, Cloud Tasks
- beanstalkd's exact binlog format