Sequential Consistency in Distributed Systems
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Sequential Consistency in Distributed Systems is a correctness condition first proposed by Leslie Lamport in 1979 for the behavior of memory operations in multiprocessors. As distributed systems scale and become more complex, maintaining consistency across different nodes becomes crucial, especially in systems that handle concurrent operations by multiple users or processes.
What is Sequential Consistency?
Sequential Consistency (SC) is a model used in distributed systems to achieve high reliability and sanity in environments where multiple processes operate concurrently. SC ensures that all operations within the system appear to be executed in some sequential order which is consistent with the order of operations in each individual process. In simpler terms, the result of any execution is the same as if the operations of all the processes were executed in some sequential order, and the operations of each individual process appear in this sequence in the order specified by its program.
Technical Specifications
In a sequentially consistent system, the following must be met:
- Program Order: The order in which each individual process executes its own instructions must be preserved in the final result.
- Single, Global Order: There exists a hypothetical single, global order of all operations across all processes that respects the above program order.
These criterions ensure coherence in the behavior of a distributed system. Unlike other models like linearizability, which is stricter and requires that each operation also appears instantaneous, sequential consistency merely focuses on maintaining an order that respects the local order of processes.
Differences from Other Consistency Models
Sequential Consistency is often confused with other models like linearizability and causal consistency. Here are some nuances:
- Linearizability requires operations to appear instantaneously, locking the operation sequence in real-time, which can impact system performance under high load.
- Causal consistency only orders operations that are causally related, ignoring unrelated operations, which could be more flexible than SC but can result in less intuitive states since unrelated operations can complete in any order.
Here’s a table highlighting differences among these models:
| Consistency Model | Ordering Requirement | Performance Implication | Use Cases |
| Sequential | Respects program order | Moderate, due to order synchronization | General purpose, Batch processing |
| Linearizability | Real-time order, appears instantaneous | High, due to real-time syncing | Financial transactions, Real-time apps |
| Causal | Only orders causally related operations | Lower, due to relaxed ordering | Social media timelines, Messaging apps |
Example Use Case
Imagine a distributed database that undergoes numerous read and write operations across different servers. Sequential consistency ensures that if one process writes a data value and another subsequently reads that data, the second process reads the updated value assuming their operations are perceived to occur in sequence.
Implementing Sequential Consistency
Achieving sequential consistency involves proper synchronization mechanisms across distributed processes. Common strategies include:
- Timestamping: Each operation is timestamped, and a global arbiter ensures orderly processing based on these timestamps.
- Locks and semaphores: These traditional synchronization primitives can help in creating a sequential order but could limit performance scalability in very large systems.
- Message passing: Ensuring operations are delivered and processed in order using message queues.
Advantages and Drawbacks
Advantages:
- Simplified Programming Model: Easier to reason about than more relaxed models such as eventual consistency.
- General Applicability: It can be utilized in various types of applications offering reasonable concessions between performance and consistency.
Drawbacks:
- Performance Overhead: The need to maintain a strict order can introduce delays.
- Scalability Issues: As the number of nodes in a distributed system increases, maintaining strict operation order across the system can become challenging.
Conclusion
Sequential consistency offers a compromise between strict data accuracy and system performance. While not as strict as linearizability, it provides a more predictable model than causal or eventual consistency, making it suitable for a wide range of applications where understanding the order of operations across processes is crucial. For optimal implementation, the choice of synchronization techniques and the specific requirements of the application play a critical role in leveraging the benefits of sequential consistency in distributed systems.
Related reading
- Server Sent Events In a Kubernetes Cluster
- Service discovery vs load balancing
- Service located in another namespace
- Service Meshes like Istio vs. Event-Driven architecture for Microservices
- Service vs IntentService in the Android platform
- Set timestamp in output with Kafka Streams
- Set up of Hyperledger fabric on 2 different PCs
- Setting Partition Strategy in a Kafka Connector

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.