Company
Date Published
Author
Ben Darnell
Word count
305
Language
English
Hacker News points
None

Summary

CockroachDB employs the Raft consensus algorithm to maintain data consistency despite machine failures, but unlike systems like etcd and Consul which use a single Raft group, CockroachDB divides data into ranges, each with its own consensus group. This structure results in nodes participating in a vast number of consensus groups, creating unique challenges that are addressed by the MultiRaft layer, which manages all of a node's ranges collectively rather than independently. This approach reduces heartbeat traffic by ensuring that each pair of nodes only needs to exchange heartbeats once per tick, regardless of shared ranges, and enhances efficiency by requiring a constant, minimal number of goroutines. The implementation of this system benefits from collaboration with the etcd team from CoreOS, allowing CockroachDB to adapt the clean abstractions of etcd's Raft implementation to meet its specific needs and contribute improvements back to the community.