System Design Beginner
01 Data Modeling & Storage
A schema is a bet on your access patterns. Model the entities first, then let how the data is actually read decide the keys, the indexes, and ultimately which kind of store it lives in.
You need a session store: 50 million live sessions, reads and writes only ever by session id, every session expires after 30 days idle, 5,000 writes per second, no joins, no ad-hoc queries. Pick a storage system (relational database or in-memory key-value store), justify the choice with three properties of THIS workload, and name one real thing you give up.
Hints
- Match workload shape to storage shape: is the access pattern rich queries, or exact-key lookup?
- Which of the two systems gives you the 30-day idle expiry for free?
- Every choice loses something. What can a relational database do that your pick cannot?