I have a question. I read many blogs, websites about CAP theorem. They say that single-node systems are CA, but how can it be "A" if that single node goes down ? Because if it does, the system will be unavailable, right ? And is "availability" in CAP equal to "availability" in HA of distributed systems ?
1 Answer
Awesome question!
1. We can build this chain:
One have to pick between C and A only when partitioning is happening. If there is no partitioning at any given time, then both C and A are reachable.
Since a single node system can not be partitioned, then it has to be both C and A.
2. Another option is to take a system and try to put it into a category: CP, AP or CA.
- CP - those system who sacrifice availability when partitioned
- AP - those system who sacrifice consistency when partitioned
- CA - those system who sacrifice partitioning; but there is only one type of systems without partitioning - single node systems!
At the end of the day, this confusion is based on theorem being applied out of context.
Every theorem has a specific context where it can be applied. CAP is applicable for distributed systems, hence it is not applicable to single node system.
-
1$\begingroup$ Realistically, single-node systems are CP. If the memory is partitioned from the CPU, the whole system crashes, but maintains consistency. CA only means that partitions are so rare you do not care what happens if one does occur. Perhaps it is even a valid design choice to over-engineer a distributed system so that partitions rarely occur. $\endgroup$ Mar 15, 2022 at 10:58
-