Technical Hard Software Engineer Backend Data Engineer

Explain the CAP theorem and PACELC theorem in distributed systems.

Practise this question with AI feedback

Record your spoken answer or type your response to receive immediate scoring and STAR improvements.

💡 Suggested Approach & Sample Answer

Theoretical Foundations & Practical Trade-offs:

1. CAP Theorem:
- In a distributed data store, when a Network Partition (P) occurs, the system must choose between:
- Consistency (C): Every read receives the most recent write or an error.
- Availability (A): Every non-failing node returns a response, but it may contain stale data.
- Note: Network partitions are unavoidable in real networks, so distributed systems are practically categorized as CP (e.g., etcd, HBase) or AP (e.g., Cassandra, DynamoDB).

2. PACELC Theorem (Extended CAP):
- Addresses a major limitation of CAP: CAP only describes system behavior during a rare network partition.
- Formula: If there is a Partition (P), how does the system trade off Availability (A) and Consistency (C)? Else (E), when the system is running normally, how does it trade off Latency (L) and Consistency (C)?
- Examples:
- Cassandra is PA/EL: Prioritizes Availability during partitions, and Latency during normal operations (eventual consistency).
- MongoDB / HBase is PC/EC: Prioritizes Consistency during partitions, and Consistency over latency during normal operations.

🎯 What Interviewers Listen For

How would you answer this in a real interview?

Use our free AI mock practice tool to test your response, analyze speaking pacing, and refine your STAR structure.

🔗 Related Technical Questions