Strict consistency vs atomic consistency
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
In distributed systems, ensuring data consistency across multiple nodes is crucial but challenging. Two primary models employed to handle this requirement are strict consistency and atomic (or linearizable) consistency. Understanding the differences between these models can help in making informed decisions when designing or choosing distributed systems.
Strict Consistency
Strict consistency is the strongest form of consistency in distributed systems. Under strict consistency, any read operation that follows a write operation must return the value written by the write operation. This must hold true across all nodes in the system at any instant. In other words, the system must appear as if all operations are happening instantaneously.
Example of Strict Consistency
Consider a distributed database that holds a counter with an initial value of 0. If a client updates this counter to 1 and another client immediately reads the counter, under strict consistency, the read must return 1 regardless of the node handling this read request.
Strict consistency, however, is rarely feasible in real-world systems due to the significant overhead involved in ensuring instantaneous updates across all nodes. It often requires a level of coordination that introduces substantial latency into every write operation, thus affecting system performance.
Atomic Consistency
Atomic consistency, often referred to as linearizability, ensures that all operations appear to be instantaneously atomic. This consistency model provides a guarantee that writes will effectively appear to be instantaneous to external observers and follow some sequence that respects the real-time ordering of operations.
Example of Atomic Consistency
Consider a scenario in a distributed system where two clients are interacting with the same data element. If Client A writes a value at time and Client B writes another value at time (), then any read happening after time should reflect the update made by Client B, following the correct sequence regardless of the actual propagation delays across the nodes.
Atomic consistency is considered slightly more practical than strict consistency, as it provides a balance between consistency and performance. It assures that every node in the system agrees on the sequence of operations, which makes it suitable for applications requiring high consistency but where slight delays are acceptable.
Comparison Table
| Consistency Type | Definition | Guarantees | Use Case |
| Strict Consistency | Immediate consistency across all nodes. | Sequential consistency at any instant. | High-performance computing clusters |
| Atomic Consistency | Consistency that appears instant and respects real-time order. | Operations are linearizable and sequential. | Distributed databases, financial transactions |
Additional Considerations
Performance Implications
- Strict Consistency: Leads to high latency and lower throughput due to the overhead of instant synchronization.
- Atomic Consistency: Offers a balanced approach but still can incur overhead due to maintaining the sequence of operations.
System Design
- Systems designed for strict consistency often require sophisticated synchronization mechanisms, like barrier synchronization or consensus protocols.
- Systems optimizing for atomic consistency might use algorithms like Paxos or Raft for consensus to ensure that the sequence of writes is agreed upon by all nodes.
Suitability
- Strict Consistency: Ideal for applications where precision and immediacy are more critical than performance, such as systems used in scientific simulations.
- Atomic Consistency: Suited for applications like online transaction processing systems where consistency needs to be high, but the tolerance for slight delays exists.
Each consistency model serves its purpose and comes with its trade-offs. The choice between strict and atomic consistency should be guided by the specific requirements and constraints of the application and its operating environment. Understanding these nuances can lead to better system design and improved overall system behavior in distributed environments.
Related reading
- Strict serializability example clarification?
- String concatenation in MySQL
- Strings as Primary Keys in MYSQL Database
- strong consistency for reads on aerospike - why do they need regime numbers?
- Strong Consistency in Cassandra
- Strong Consistency vs. Read-after-write Consistency
- Subqueries vs joins
- Suggest Cassandra data model for an existing schema

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.