CAP Theorem
- Consistancy
- Availability
- Partition Tolerance
One of the must be sacrified.
- Consistency - A read is guaranteed to return the most recent write for a given client.
- Availabillity - A non-failing node will return a reasonable response within a reasonable amount of time (no error or timeout)
- Partition Tolerance - The system will continue to function when network partitions occur.
Why?
- CP - Consistency/Partition Tolerance - Wait for a response from the partitioned node which could result in a timeout error. The system can also choose to return an error, depending on the scenario you desire. Choose Consistency over Availability when your business requirements dictate atomic reads and writes.
- AP - Availability/Partition Tolerance - Return the most recent version of the data you have, which could be stale. This system state will also accept writes that can be processed later when the partition is resolved. Choose Availability over Consistency when your business requirements allow for some flexibility around when the data in the system synchronizes. Availability is also a compelling option when the system needs t o continue to function in spite of external errors (shopping carts, ect..)
Falaccy of distributed computing is:
- The network is reliable
- Latency is zero
- Bandwidth is infinite
- The network is secure
- Topology doesn't change
- There is one administrator
- Transport cost is zero
- The network is homogeneous