CAP 定理指出,一个分布式系统最多只能同时保证三个特性中的两个 — 一致性(Consistency)、可用性(Availability)和分区容错性(Partition tolerance)。由于网络分区是不可避免的,实际的选择是在分区期间在一致性和可用性之间进行权衡。
三个特性
CONSISTENCY (C) → every read sees the latest write (all nodes agree on the data)
AVAILABILITY (A) → every request gets a response (the system stays responsive)
PARTITION TOLERANCE (P) → the system keeps working despite network partitions
(communication breaks between nodes)
→ CAP: you can only fully guarantee TWO of these three simultaneously.
