CAP theorem
Consistency, Availability, and Partition tolerance
Consistency — Consider multiple nodes/partition where are getting replicated and data should consistent in both the databases.
Availability — Databases should be up all the time and provide us some response.
Partition tolerance — When there is a fault in databases connections the system should be able to handle such a condition.
CAP theorem states that only 2 property can be achieved.
CA — if system is consistent and available all the time then it is not possible to make the system the partition tolerance because due to availability the databases are up all the time and also consistent thus if any fault occurs then either node is not available or data is not consistent if we make the system based on CA then at fault cases we need to shut the entire system because system is not partition tolerance.
AP — Available all the time and system should be Patition tolerance so when their a fault occurs the consistency of the system of getting affected as the system is up all and retrieving the value at this moment will yeild different values.
CP — System should be consistent and have partition tolerance make the system not available all the time as there occur partition tolerance then to make the system consistent we need to down the node which is affected due to partition.
A (Application)
/ \
B-C (nodes/partition — containing replicated databases)