QA
Beginner LevelSystem Design & Architecture

Explain the CAP Theorem and PACELC Theorem with real-world database examples.

❓ Interview Prompt: What are Consistency, Availability, and Partition Tolerance? How does PACELC expand CAP when no network partition exists?

The CAP Theorem states that a distributed system can only provide at most 2 out of 3 guarantees during a network partition:

β€’
CP (Consistency + Partition Tolerance): Rejects writes/reads if data sync cannot be guaranteed across nodes (e.g. HBase, MongoDB with strict write concerns).
β€’
AP (Availability + Partition Tolerance): Returns stale data rather than erroring (e.g. Cassandra, DynamoDB).

PACELC Theorem:

Extends CAP:

β€’
If Partition (P): Choose between Availability (A) or Consistency (C);
β€’
Else (E): Choose between Latency (L) or Consistency (C).

Example: DynamoDB defaults to PA/EL (prioritizes availability during partitions, low latency normally).

Code Implementation Example

markdown
PACELC Decision Matrix:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        PACELC                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚   If Network Partition    β”‚      Else (Normal)         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Availabilityβ”‚ Consistency β”‚ Low Latency  β”‚ Consistency β”‚
β”‚   (AP)      β”‚    (CP)     β”‚    (EL)      β”‚    (EC)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
πŸ’‘PACELC database trade-off matrix.
🎯 Interview Key Takeaway

System design requires balancing consistency against availability and network latency depending on business SLAs.

#System Design#CAP Theorem#PACELC#Architecture#Beginner
Back to all System Design & Architecture Questions→

More System Design & Architecture Interview Questions

Beginner LevelSystem Design & Architecture

What is Vertical Scaling (Scale Up) vs Horizontal Scaling (Scale Out)?

Beginner LevelSystem Design & Architecture

How do Load Balancers distribute traffic (Round Robin, Least Connections, IP Hash)?

Beginner LevelSystem Design & Architecture

What is a Content Delivery Network (CDN) and how does Edge Caching reduce latency?