CAP abbreviation means: Consistency, Availability and Partitioning tolerance. Theorem states, that distributed data store can have two of three guarantees:
- Consistency - every read from the store will receive most recent write result.
- Availability - application is highly available. Almost all requests will be returned with a response.
- Partitioning tolerance - ability to distribute / partition data store.
In microservice architecture, which is distributed by its nature, you cannot have option CA.
- You can choose from the PA and data will be eventually consistent.
- Or you can have CP, but not always an available service to respond. Handling distributed data stores syncing can take time. This means you need to use locks and persistent queues to support data sync.