In short
- redcrab is a streaming broker that speaks the Kafka wire protocol: one Rust binary, no JVM, no ZooKeeper, Raft replication per partition.
- It is a clean-room implementation, tested with the stock Apache Kafka command-line tools, and MIT licensed.
- The benchmark came before the broker. redcrab is pre-alpha and looking for people to run it, measure it and break it.
Why another broker
redcrab started after the redpanda-data/redpanda repository was archived on GitHub. I wanted a small, Kafka-compatible broker that ships as a single binary and that anyone can read, run and change.
It is written from scratch, from the public Kafka protocol documentation and the Raft paper, and contains no source code from Redpanda or Apache Kafka. Existing Kafka clients work against it unchanged; so far the Kafka 4.4.0 Java clients are the ones tested.
Five minutes with stock Kafka tools
git clone https://github.com/Shindora/redcrab.git && cd redcrab
cargo build --release
# listens on 0.0.0.0:9092 and tells clients in containers where to connect
./target/release/redcrab --advertised-host host.containers.internalThen create a topic, produce and consume with the official Kafka CLI, here from the apache/kafka image:
kafka_cli() { podman run --rm -i docker.io/apache/kafka:4.4.0 "$@"; }
B=host.containers.internal:9092
kafka_cli /opt/kafka/bin/kafka-topics.sh --bootstrap-server $B \
--create --topic demo --partitions 3 --replication-factor 1
printf 'hello\nfrom\nredcrab\n' | kafka_cli \
/opt/kafka/bin/kafka-console-producer.sh --bootstrap-server $B --topic demo
kafka_cli /opt/kafka/bin/kafka-console-consumer.sh --bootstrap-server $B \
--topic demo --group demo-group --from-beginning --max-messages 3Every write acknowledged with acks=1 or acks=all is already fsynced, so kill -9 loses nothing that was acknowledged. Ctrl-C answers the requests already read, fsyncs and exits cleanly.
A three-node cluster
PEERS=1@127.0.0.1:19093/host.containers.internal:19092
PEERS=$PEERS,2@127.0.0.1:29093/host.containers.internal:29092
PEERS=$PEERS,3@127.0.0.1:39093/host.containers.internal:39092
for id in 1 2 3; do
./target/release/redcrab --node-id $id --peers "$PEERS" \
--listen 0.0.0.0:${id}9092 --rpc-listen 127.0.0.1:${id}9093 \
--data-dir redcrab-data-$id &
doneCreate a topic with replication factor 3 and the leaders spread across the three nodes. The cluster survives the loss of any one node, and a node restarted with the same flags and data directory catches up on its own.
What works, and what does not yet
Works today: a single node or a fixed cluster; one Raft group per partition plus a metadata group; topics with 1 to 10,000 partitions; produce and fetch where acks=all waits for a majority to fsync and reads stop at the high watermark; classic consumer groups with replicated offsets; a segmented log with CRC-32C checks and crash recovery.
Not yet: adding or removing nodes, retention and compaction (disk only grows), idempotence checks and transactions, TLS, SASL, ACLs and metrics, and the KIP-848 consumer protocol.
Pre-alpha means it. There is no authentication or encryption, crafted large requests can still exhaust memory, and a retried produce can be stored twice. Do not put production data on it or expose it to untrusted networks.
Benchmark first
The benchmark is the project’s most important deliverable, and it was built before the broker. The question it answers: under the same durability guarantees, how does a small Rust broker compare with Apache Kafka and Redpanda? The fairness rules are worth stealing for any broker comparison:
- Same client, settings and resources. The perf tools from one pinned
apache/kafkaimage, identical producer and consumer settings, and the same machine, workloads and memory cap per broker. - Same durability.
acks=alleverywhere, withmin.insync.replicasof 1 on one broker and 2 on three. - Kafka twice. Once with its default, which does not fsync before acknowledging, and once with
flush.messages=1, which does, like Redpanda and redcrab. Otherwise you compare different guarantees. - Redpanda with write caching off, and not in developer mode.
- Settings read back. Each result records the effective broker and topic configs, so nobody has to trust the setup on faith.
I am not quoting numbers yet. Today’s runs are local smoke tests in a small laptop VM, and they vary from run to run. The publishable runs, OpenMessaging Benchmark on dedicated Linux hosts with NVMe drives, are the next milestone, and their configurations are already in bench/omb/.
The harness also checks failover. It writes increasing integers with acks=all, kills the partition leader or cuts brokers off the network, and verifies that every acknowledged record can be read back. In a few local runs, no acknowledged record went missing. That is encouraging, and not a proof.
Inside
client ─TCP─> server.rs frames and checks requests
└─> api.rs one handler per Kafka API
├─> broker.rs ─> cluster.rs ─> replica.rs a Raft group per partition
│ ├─> raft.rs elections, commit
│ ├─> storage.rs segmented log
│ └─> transport.rs node-to-node RPC
└─> group.rs classic consumer groupsKafka connections run on a multi-threaded Tokio runtime. Raft groups run on a few shard threads, fsyncs and reads on the blocking pool, and the node-to-node transport on plain threads. Tests include end-to-end clusters over TCP and simulated power failures that drop unsynced data.
How to help
- Point your Kafka client at it and report what breaks. Clients other than the Java 4.4.0 ones are untested.
- Run the benchmark on real hardware. The OpenMessaging Benchmark configurations are ready.
- Pick up the roadmap: thread-per-core, io_uring and O_DIRECT, retention and compaction, then idempotent producers and transactions.
Contributions must stay clean-room: nothing copied from, translated from or derived from the Kafka or Redpanda brokers. Work from the protocol docs, KIPs and papers; running Kafka or Redpanda as black boxes is fine. The code is on GitHub under the MIT license.