Home Knowledge Base Advanced Distributed Consensus

Advanced Distributed Consensus covers optimized implementations and variants of consensus protocols (Raft, Multi-Paxos, and beyond) that achieve high throughput and low latency for replicated state machines in production distributed systems — going beyond basic correctness to address real-world performance, batching, pipelining, and multi-group scalability.

Multi-Paxos Optimizations: Basic Paxos requires 2 round-trips per value (Prepare + Accept). Multi-Paxos elects a stable leader that skips the Prepare phase for subsequent proposals, achieving single round-trip (Accept only) in steady state. Further optimizations:

Raft Optimizations:

OptimizationMechanismBenefit
Log batchingBundle entries per AppendEntriesHigher throughput
PipeliningSend next batch before ackHide network latency
Read leasesLeader serves reads without consensus10-100x read throughput
Pre-voteCheck electability before electionAvoid disruptive elections
Joint consensusTwo-phase membership changeSafe reconfiguration
Learner nodesNon-voting replicasRead scaling

Read Optimizations: Linearizable reads typically require a consensus round (to confirm leadership is current). Alternatives: ReadIndex — leader confirms majority heartbeat, then serves read from current commit (one round trip, no log entry); Lease-based reads — leader holds a time-based lease during which it's guaranteed to be leader, serving reads locally with no communication (requires synchronized clocks within lease duration).

Multi-Group Consensus: A single Raft/Paxos group becomes a bottleneck at high throughput. Production systems shard data across many consensus groups (e.g., TiKV uses one Raft group per data region, CockroachDB per range). Challenges: colocated groups — a single server participates in thousands of Raft groups, requiring efficient multiplexing of heartbeats and log storage; cross-group transactions — operations spanning multiple groups require two-phase commit layered above consensus; and group management — splitting, merging, and rebalancing groups as data grows.

State Machine Replication Pitfalls: Log compaction — unbounded log growth requires periodic snapshotting; snapshot transfer to slow followers must not block normal operation. Membership changes — adding/removing nodes safely requires consensus protocol support to avoid split-brain. Disk I/O — consensus requires durable writes (fsync) on the critical path; batching fsync operations is essential for performance.

Advanced consensus protocols achieve the seemingly impossible — strong consistency with throughputs of millions of operations per second and sub-millisecond latency — through careful engineering of batching, pipelining, and read optimizations that reduce the cost of agreement to its theoretical minimum.

distributed consensus advancedRaft optimizationMulti-Paxosconsensus performance

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.