Module 6 - Distributed Systems

PACELC Theorem

CAP extended: what happens when there's NO partition?

1Beyond CAP

Simple Analogy
CAP says "during a partition, choose C or A." But networks aren't always partitioned. When things are normal, do you optimize for latency or consistency? PACELC answers: even without partitions, there's a trade-off.

PACELC: If there is a Partition, choose Availability or Consistency. Else (no partition), choose Latency or Consistency.

2The Complete Picture

SystemIf Partition (P)Else (E)PACELC
DynamoDBAvailableLow LatencyPA/EL
CassandraAvailableLow LatencyPA/EL
MongoDBConsistentConsistentPC/EC
PNUTS (Yahoo)ConsistentLow LatencyPC/EL

3Real-World Dry Run

Scenario: Global User Profile Service

1
User updates profile in US
Write goes to US replica
2
Same user reads from EU
EU replica hasn't synced yet
EC (Consistent)

EU read waits for US sync (100-200ms latency). User sees updated profile.

Trade-off: Higher latency, perfect consistency

EL (Low Latency)

EU read returns immediately with cached data (5ms). User sees old profile for a few seconds.

Trade-off: Low latency, eventual consistency

4System Classifications

PA/EL

Prioritize availability and low latency. Sacrifice consistency.

Examples: DynamoDB, Cassandra, Riak

Use case: Social feeds, shopping carts, session stores

PC/EC

Prioritize consistency always. Sacrifice availability and latency.

Examples: MongoDB (strong), VoltDB

Use case: Banking, inventory, bookings

PA/EC

Available during partition, consistent otherwise. Rare.

Examples: Configurable systems

Use case: Mixed workloads

PC/EL

Consistent during partition, low latency otherwise.

Examples: PNUTS

Use case: User profiles, preferences

5Key Takeaways

1PACELC extends CAP: considers behavior when NO partition
2Even without partitions, trade-off between Latency and Consistency
3PA/EL: fast and available (DynamoDB, Cassandra)
4PC/EC: consistent always (MongoDB strong mode)
5Most real systems are PA/EL for user-facing workloads

?Quiz

1. No partition. You want sub-10ms reads globally. PACELC choice?

2. DynamoDB's PACELC classification is: