Availability
Every request receives a (non-error) response
“Availability means that every request receives a response, without guarantee that it contains the most recent write.” – Eric Brewer
When to use
When uptime is more important than perfect data accuracy (Social Media feeds, Shopping carts).
Why it matters
- User Experience: Users hate “System Down” or timeouts. It’s better to show a slightly old list of posts than an error page.
- Revenue: Amazon found that 100ms latency cost 1% in sales. Availability (always responding) is king for retail.
Signs of Violation
- “Service Unavailable” errors when a database node is down.
- System locking up waiting for a sync that never happens.
Explanation
Problem
If you insist on perfect Consistency, and a network cable is cut, you have to stop accepting writes (System Down).
Solution
Accept the write on the available node, even if it can’t talk to the others yet. Resolve conflicts later.
Real world analogy
Calling a call center. If the “Main” agent is busy, you get routed to “Backup” agent in another city. They might not know you just called 5 mins ago (State consistency), but at least they answer the phone (Availability).
Pros and Cons
| Pros | Cons |
|---|---|
Comparison
- High Availability (HA): A general engineering term, but in CAP it specifically means “choosing uptime over consistency during a partition”.
Code example
Typescript
Bad (Violation - CP)
Good (Adherence - AP)
PHP
Good (Adherence)