Raft Consensus Simulator
Distributed consensus visualization with leader election, log replication, and network partitions.
Try: Partition leader → Write (minority side) → Timeout on node 3 → Write (majority side) → Heal network.
About this tool
Raft is a consensus algorithm: it lets a cluster of servers agree on one ordered log of commands even when some of them crash or the network splits. One node is elected leader for a numbered term; clients send writes to the leader, which replicates them with AppendEntries. An entry is committed — safe forever — once a majority of nodes store it. etcd, Consul, CockroachDB and TiKV all run Raft.
This lab simulates a five-node cluster. You can write commands, crash and restart nodes, force election timeouts, and partition the leader away from the majority. Every step explains which messages were sent, how many votes or acknowledgements arrived, and why an entry did or did not commit.
How to use Raft Consensus Simulator
- Send a client write and watch the entry appear uncommitted on the leader, replicate, and turn committed once 3 of 5 nodes have it.
- Crash a follower and write again: four nodes are still a majority, so writes keep committing.
- Partition the leader, then write on the minority side: the entry never commits.
- Trigger a timeout on a node in the majority to elect a new leader, write there, then heal the network and watch the old leader step down and discard its uncommitted entry.
Examples
Commit rule
5 nodes, leader appends “x=1”, 2 followers acknowledge
Leader + 2 = 3 ≥ majority 3 → committed
Split brain avoided
Leader isolated with 1 follower
Its writes reach only 2 of 5 nodes and stay uncommitted; the other 3 elect a new leader with a higher term
The safety rules that matter
- Each node votes at most once per term, so a term has at most one leader.
- A node only votes for a candidate whose log is at least as up to date as its own, so a new leader already holds every committed entry.
- Followers delete entries that conflict with the leader’s log; such entries were never committed.
- Any two majorities overlap in at least one node — that is what makes commits durable.
Cluster size
A cluster of 2f + 1 nodes tolerates f failures: 3 nodes survive 1 failure, 5 survive 2. Adding a fourth node does not improve fault tolerance over three, it only raises the majority to 3, which is why odd sizes are standard.
Frequently asked questions
Everything you need to know about this tool and data security.
Why are election timeouts randomized?
If all followers timed out together they would split the vote repeatedly. Random timeouts (e.g. 150–300 ms) make it likely that one node starts and wins before the others wake up.
What does the minority leader’s client see?
No success. The write times out or fails, and the client retries against the new leader. Raft never acknowledges an uncommitted write.
How does Raft compare to Paxos?
They give the same guarantees. Raft was designed to be easier to understand and implement, with a strong leader and a clearly specified log-repair procedure.
Is my data safe when using this tool?
Yes, 100% safe. This tool operates entirely inside your web browser using client-side JavaScript and WebAssembly. Your data never touches any external server.
Related Tools
Consistent hashing ring simulator with virtual nodes and rehash avalanche analysis.
Simulate Kube-Scheduler filter/score phases and Deployment reconciliation loops.
Interactive BST visualizer with insertion, deletion, and tree traversals.
Featured Projects tech-fun.net
Explore more AI & productivity tools
Nihongo GameBox
Master Japanese typing, Kana, and JLPT N5–N1 vocabulary through interactive retro arcade games.
ResumeGPT
Tailors CVs and cover letters to every job opportunity with a multi-agent LLM pipeline, job tracking, and scheduled discovery.
CollectMind
Turns your bookmarks into a searchable AI knowledge base — entirely on-device, powered by Chrome's built-in Gemini Nano.