RTUComputer ScienceYr 2024 · Sem 62024

Q5Distributed System

Question

10 marks

What are consistency models? Explain Data-centric consistency models in detail.

Answer

A massive architectural review of Data-Centric Consistency Models. Violently contrasts the mathematically impossible Strict Consistency against Sequential, Causal, and the highly scalable Eventual Consistency utilized in modern Hyperscale NoSQL databases.

In a massive distributed database, data is violently replicated across 50 servers to maximize read speeds and fault tolerance. However, this creates a catastrophic mathematical paradox: if User A updates their profile on Server 1, how do we guarantee that User B reading from Server 50 sees the updated profile? A Consistency Model is a rigid mathematical contract between the Database and the Programmer. It dictates exactly how much chaos and "staleness" the programmer must tolerate in exchange for massive system performance.

These models focus on the absolute global state of the replicated data across all physical servers.

1. Strict Consistency (The Mathematical Impossible)

The absolute holy grail. It dictates that ANY read on ANY data item will instantly return a value corresponding to the result of the absolute most recent write on .

  • Reality: It mathematically assumes that a write operation propagates to all 50 servers in absolutely zero time. Because data cannot physically travel faster than the speed of light, Strict Consistency is mathematically impossible in a geographically distributed system.

2. Sequential Consistency

A slightly weaker, physically possible model. It abandons absolute physical time. Instead, it mathematically guarantees that all 50 servers will violently execute all write operations in the exact same sequential order.

  • Mechanism: If Server 1 sees Write A then Write B, Server 50 MUST mathematically also see Write A then Write B. No server is allowed to see B before A.
  • Demerit: Enforcing this strict global ordering requires massive synchronization overhead (locking the network), making write operations catastrophically slow.

3. Causal Consistency

A highly optimized model based on Lamport's logical clocks. It relaxes Sequential Consistency by only enforcing order on writes that are mathematically related.

  • Mechanism: If Write B is mathematically dependent on Write A (e.g., a reply to a forum post), the database strictly guarantees every server sees A before B. However, if Write C is completely unrelated, servers can see C at any random time.
  • Merit: Drastically reduces network locking, massively increasing performance while maintaining logical application integrity.

4. Eventual Consistency (The Hyperscale Standard)

The absolute dominant architecture for massive, highly available systems like Amazon DynamoDB or Cassandra. It violently sacrifices mathematical accuracy for absolute maximum performance and availability.

  • Mechanism: If no new updates are made to a specific piece of data, the database mathematically promises that "eventually" all 50 replicas will synchronize and agree on the final value.
  • Reality: If you update your Facebook status on Server 1, and your friend refreshes Server 50 a millisecond later, they might violently read the old status (stale data). The system accepts this temporary inconsistency because forcing the servers to lock and synchronize would cause a catastrophic 5-second lag for every single user on the platform. Performance is mathematically prioritized over immediate perfection.
Back to Paper