Skip to main content

Command Palette

Search for a command to run...

Consistency Spectrum

Updated
β€’2 min read

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

More from this blog

The Backend Techie

10 posts