Distributed Consensus

  1. Consensus in Crash-Failure Models
    1. The Paxos Protocol
      1. Historical Context
        1. Leslie Lamport's Work
          1. The Part-Time Parliament
            1. Evolution of the Algorithm
            2. Roles in Paxos
              1. Proposer
                1. Proposal Number Generation
                  1. Value Selection
                    1. Phase Coordination
                    2. Acceptor
                      1. Promise Phase Handling
                        1. Accept Phase Handling
                          1. State Maintenance
                          2. Learner
                            1. Decision Learning
                              1. Value Dissemination
                                1. Optimization Strategies
                                2. Client
                                  1. Request Submission
                                    1. Response Handling
                                      1. Retry Mechanisms
                                    2. Single-Decree Paxos
                                      1. Algorithm Overview
                                        1. Phase 1: Prepare
                                          1. Prepare Request Format
                                            1. Promise Response Handling
                                              1. Highest Proposal Tracking
                                              2. Phase 2: Accept
                                                1. Accept Request Format
                                                  1. Acceptance Criteria
                                                    1. Decision Formation
                                                    2. Correctness Properties
                                                      1. Safety Guarantees
                                                        1. Liveness Conditions
                                                          1. Proof Sketches
                                                        2. Multi-Paxos
                                                          1. Motivation for Multi-Paxos
                                                            1. Leader Election
                                                              1. Leader Selection Process
                                                                1. Failure Detection
                                                                  1. Re-election Mechanisms
                                                                  2. Log Replication
                                                                    1. Ordered Log Maintenance
                                                                      1. Gap Handling
                                                                        1. Conflict Resolution
                                                                        2. State Machine Replication
                                                                          1. Deterministic Execution
                                                                            1. Command Application
                                                                              1. Snapshot Management
                                                                            2. Paxos Variants
                                                                              1. Fast Paxos
                                                                                1. Latency Reduction
                                                                                  1. Direct Client Communication
                                                                                    1. Collision Handling
                                                                                    2. Cheap Paxos
                                                                                      1. Cost Optimization
                                                                                        1. Auxiliary Acceptors
                                                                                          1. Reconfiguration
                                                                                          2. Generalized Paxos
                                                                                            1. Command Commutativity
                                                                                              1. Parallel Execution
                                                                                                1. Dependency Tracking
                                                                                                2. Flexible Paxos
                                                                                                  1. Quorum Flexibility
                                                                                                    1. Phase Decoupling
                                                                                                      1. Performance Benefits
                                                                                                  2. The Raft Protocol
                                                                                                    1. Design Philosophy
                                                                                                      1. Understandability Focus
                                                                                                        1. Modular Decomposition
                                                                                                          1. Educational Value
                                                                                                          2. Core Components
                                                                                                            1. Leader Election
                                                                                                              1. Election Process
                                                                                                                1. Term Management
                                                                                                                  1. Vote Splitting Prevention
                                                                                                                  2. Log Replication
                                                                                                                    1. AppendEntries RPC
                                                                                                                      1. Log Consistency
                                                                                                                        1. Heartbeat Mechanism
                                                                                                                        2. Safety Mechanisms
                                                                                                                          1. Election Safety
                                                                                                                            1. Leader Append-Only
                                                                                                                              1. Log Matching Property
                                                                                                                                1. Leader Completeness
                                                                                                                                  1. State Machine Safety
                                                                                                                                2. Server States
                                                                                                                                  1. Follower State
                                                                                                                                    1. Passive Behavior
                                                                                                                                      1. Request Forwarding
                                                                                                                                        1. Election Timeout
                                                                                                                                        2. Candidate State
                                                                                                                                          1. Election Initiation
                                                                                                                                            1. Vote Collection
                                                                                                                                              1. State Transitions
                                                                                                                                              2. Leader State
                                                                                                                                                1. Log Management
                                                                                                                                                  1. Client Interaction
                                                                                                                                                    1. Heartbeat Sending
                                                                                                                                                  2. Log Structure and Management
                                                                                                                                                    1. Log Entry Format
                                                                                                                                                      1. Command Content
                                                                                                                                                        1. Term Numbers
                                                                                                                                                          1. Index Positions
                                                                                                                                                          2. Commit Process
                                                                                                                                                            1. Majority Replication
                                                                                                                                                              1. Commit Index Advancement
                                                                                                                                                                1. State Machine Application
                                                                                                                                                                2. Log Compaction
                                                                                                                                                                  1. Snapshot Creation
                                                                                                                                                                    1. Log Truncation
                                                                                                                                                                      1. Snapshot Transfer
                                                                                                                                                                    2. Membership Changes
                                                                                                                                                                      1. Configuration Changes
                                                                                                                                                                        1. Joint Consensus Approach
                                                                                                                                                                          1. Old and New Configuration
                                                                                                                                                                            1. Transition Safety
                                                                                                                                                                              1. Commit Requirements
                                                                                                                                                                              2. Single-Server Changes
                                                                                                                                                                                1. Adding Servers
                                                                                                                                                                                  1. Removing Servers
                                                                                                                                                                                    1. Catch-up Mechanisms
                                                                                                                                                                                  2. Raft vs Paxos Comparison
                                                                                                                                                                                    1. Algorithmic Differences
                                                                                                                                                                                      1. Performance Characteristics
                                                                                                                                                                                        1. Implementation Complexity
                                                                                                                                                                                      2. Other Crash-Tolerant Protocols
                                                                                                                                                                                        1. Viewstamped Replication
                                                                                                                                                                                          1. View-based Approach
                                                                                                                                                                                            1. Primary-Backup Model
                                                                                                                                                                                              1. View Change Protocol
                                                                                                                                                                                              2. Zab Protocol
                                                                                                                                                                                                1. ZooKeeper Atomic Broadcast
                                                                                                                                                                                                  1. Leader-based Approach
                                                                                                                                                                                                    1. Recovery Mechanisms
                                                                                                                                                                                                    2. Chain Replication
                                                                                                                                                                                                      1. Linear Chain Structure
                                                                                                                                                                                                        1. Head and Tail Roles
                                                                                                                                                                                                          1. Strong Consistency Guarantees