Does only distributed systems follow CAP theorem?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
The CAP Theorem, also known as Brewer's Theorem, posited by Eric Brewer in 2000, is a fundamental principle that applies to distributed systems, particularly those that store state across multiple nodes. It asserts that a distributed system can only simultaneously guarantee two out of three aspects: Consistency, Availability, and Partition Tolerance (CAP). Here, we explore if the CAP theorem applies exclusively to distributed systems or if it has implications elsewhere.
Understanding CAP Components
- Consistency: Every read receives the most recent write or an error. Essentially, the data appears to be the same across all nodes at any instant.
- Availability: Every request receives a response, without the guarantee that it contains the most recent write.
- Partition Tolerance: The system continues to operate despite an arbitrary number of messages being dropped or delayed by the network between nodes.
Does CAP Apply Only to Distributed Systems?
Primarily, the CAP theorem targets environments where data is distributed across different network partitions. A distributed system, by its nature, involves multiple nodes over a network. Let's break down the application of the CAP theorem to other system architectures to see whether it solely pertains to distributed systems:
- Single-node Systems: In systems that do not have data replication or multiple nodes, the concept of network partitions is non-existent. Hence, considerations for partition tolerance are not applicable. Such systems can prioritize consistency and availability but do not directly relate to CAP contexts.
- Centralized Systems: Systems that use a central database server or a monolithic server architecture do not have partition tolerance issues, assuming there's no data replication over a network. These systems can achieve consistency and availability but bypass the partition tolerance requirement, which is a key aspect of the CAP theorem.
- Client-Server Models (Non-distributed): In basic client-server models where data is centralized, the lack of multiple data nodes eliminates the scenario of network partitions thus making CAP irrelevant. However, should this model extend to include data replication across geographical locations, then CAP considerations begin to apply.
Examples and Implications in Non-distributed Contexts
To illustrate, consider a traditional RDBMS running on a single server. It doesn't face partition tolerance issues and can therefore focus on maximizing consistency and availability. Contrast this with a distributed database like Cassandra, which is designed to handle large-scale network partitions across data centers. Here, partition tolerance and availability are prioritized, sometimes at the expense of consistency.
Summary Table
| Feature | Single-node System | Centralized System | Distributed System |
| Consistency | Achievable | Achievable | Optional |
| Availability | Achievable | Achievable | Optional |
| Partition Tolerance | Not Applicable | Not Applicable | Required |
| CAP Applicability | No | No | Yes |
Conclusion
Thus, the CAP theorem primarily concerns itself with scenarios where a system’s architecture involves multiple nodes potentially separated by network partitions. In essence, the theorem is a design framework used to investigate trade-offs between consistency, availability, and partition tolerance in distributed systems. Although not directly applicable to non-distributed systems, understanding the principles of CAP can still inform and influence the architectural decisions in those environments, particularly in their evolution towards distributed models to accommodate scale, resilience, and geographical distribution.
Related reading
- Does paxos provide true linearizable consistency or not?
- Does RabbitMq do round-robin from the exchange to the queues
- Does Raft send AppendEntries with logs right after election?
- Does Redis support cross replication between master/slave nodes?
- Does sequential consistency implies cache coherence?
- does slave-skip-errors avoid remove errors from the logs
- Does the Java Memory Model JSR-133 imply that entering a monitor flushes the CPU data caches?
- Does the number of consumer groups impact Kafka performance

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.