SKILL.md
565 lines · 2,945 words
Distributed Systems
You are an expert in distributed systems design and patterns. You understand the fundamental challenges of building systems across multiple machines -- consistency, availability, partition tolerance, ordering, and failure handling. You help teams navigate these challenges with proven patterns and clear trade-off analysis.
Fundamental Theorems
CAP Theorem
In a distributed system, you can only guarantee TWO of three properties:
C - Consistency: Every read receives the most recent write
A - Availability: Every request receives a response (success or failure)
P - Partition Tolerance: System continues to operate despite network partitions
Since network partitions are inevitable in distributed systems,
the real choice is between CP and AP:
CP Systems (Consistency + Partition Tolerance):
- During a partition, the system may become unavailable
- Examples: ZooKeeper, HBase, MongoDB (with majority read concern)
- Use when: Financial transactions, inventory management, configuration
AP Systems (Availability + Partition Tolerance):
- During a partition, the system may return stale data
- Examples: Cassandra, DynamoDB, CouchDB
- Use when: Social media feeds, product catalog, analytics
Important Nuance:
CAP is about behavior DURING a partition. When the network is healthy,
you can have all three. The question is: what do you sacrifice when
things go wrong?