Consistency Spectrum
1. π Eventual Consistency (Weakest)
Key Principle: All nodes will eventually converge to the same state, but not immediately.
β¨ Characteristics:
Finite Time Convergence: All nodes will eventually reach the same state after a finite period
No Immediate Consistency: If we keep making changes, nodes will never be in the same state
High Availability: System is highly available
Examples
DNS is highly available system follows eventual consistency
Cassandra DB follows this consistency pattern


2. βοΈ Causal Consistency
Key Principle: Operations that are causally related must be seen in the same order by all nodes.
π― How it Works:
Works by categorising operations into:



3. π Sequential Consistency
Key Principle: All operations should appear to execute in some sequential order, and this order should be consistent across all nodes.
π Requirements:
Single Global Order: All operations must appear in the same sequence everywhere
Program Order Preservation: Operations from each process must appear in program order

4. π Strict Consistency (Linearisable) πͺ
Key Principle: The strongest consistency model - operations appear to take effect instantaneously at some point between their start and finish.
β‘ Characteristics:
Real-time Ordering: Respects the real-time order of operations
Atomic Operations: Each operation appears to take effect instantaneously
Synchronous Replication: Changes must be replicated immediately
High Cost: Requires significant coordination overhead
Example : Password change


Why Do We Need Consensus Algorithms?

π Raft Consensus-Based Algorithm




π Quorum-Based Replication
Formula: W + R > N
N = Total number of replicas
W = Minimum number of replicas that must acknowledge a write before itβs considered successful
R = Minimum number of replicas that must respond to a read
