Skip to main content
Back to features overview

Native KRaft consensus quorum

krabka implements the Apache Kafka KRaft consensus protocol directly in memory-safe Rust (krabka-raft and krabka-kraft-core), with leader elections, metadata compaction, and no ZooKeeper dependency. The election and quorum decisions are Creusot-proved kernels, and the consensus engine has a Stateright model.

KIP-595 wire RPC interoperability

krabka implements the KIP-595 Raft RPC wire format. Controller voters exchange metadata records (PartitionRecord, TopicRecord, UserScramCredentialRecord) serialized to match Kafka's JVM implementation byte for byte.

Split roles

Nodes run as dedicated controllers, dedicated brokers, or combined broker+controller nodes, grouped into node pools.

Dynamic reconfiguration

Add or decommission controller voters on live clusters through krabka-voters without restarting the metadata quorum.

Verified elections

Randomized election timers and asynchronous heartbeats trigger a new election after a network partition. Quorum size and vote admission are Creusot-proved kernels, and the consensus engine has a Stateright model.

Quorum configuration

# broker.toml - KRaft quorum configuration for node 1
# Start with: krabka-broker --config-file broker.toml
broker_id = 1
log_dir = "/var/lib/krabka/data"

# <node_id>@<host>:<port> of each voter's controller listener
controller_quorum_voters = [
  "[email protected]:9093",
  "[email protected]:9093",
  "[email protected]:9093",
]

heartbeat_interval = "2s"
controller_election_timeout = "1s"
controller_heartbeat_interval = "500ms"

[process]
roles = ["controller", "broker"]

[[listeners]]
name = "PLAINTEXT"
bind_addr = "0.0.0.0:9092"
advertised = "broker-1.prod.internal:9092"
protocol = "Plaintext"

In-memory metadata image and snapshots

krabka-metadata maintains an in-memory metadata image. A node can catch up from a metadata snapshot when it joins or reconnects after a network partition.

Formally verified kernels and deterministic seeding

Creusot proves contracts on selected consensus and quota decision kernels in krabka-verified, which host crates such as krabka-throttle call. Log directories are seeded with krabka-format.

Seed a log directory

krabka-format --log-dir /var/lib/krabka/data --cluster-id 3d70a78c-bb3a-4af5-a767-51e31f403c62 --node-id 1 --initial-controllers [email protected]:9093:<dir-id-1>,[email protected]:9093:<dir-id-2>,[email protected]:9093:<dir-id-3>