Estimate Storage
- What’s the size of a key-value pair?
- Understand the Daily Active Users (DAU) to calculate the data usage. (e.g.
1 billion DAU * 132 bytes = 132 GB ) 5. Estimate AWS RDS/NoSQL Storage
- Data optimizations
- Data compression
- Store only frequently used data in memory and the rest on disk
Even with data optimizations, a single server can reach its capacity quickly. In this case, distributed key-value store (sharding) is required.
Database Type
RDBMS
B-Tree
More: ‣
Data store on disk using B+ Tree data structure to minimize read and write time.

Sorce: Wiki https://en.wikipedia.org/wiki/B%2B_tree
- The data are sorted in Leaf nodes, others only contain keys (indices).
- Leaf nodes are linked in a doubly-linked list for efficient range queries and sequential access.
- When running CRUD operations, it checks the indices to find the targeted range of the linked list, instead of searching from the start of the whole linked list.
- It is height-balanced, meaning operations like search, insert, and delete take O(log n) time.
ACID
- A: Atomicity: A transaction is all or nothing.
- C: Consistency: A transaction must transform data ****from one valid state to another valid state, following all constraints (e.g. Foreign Key, NOT NULL, UNIQUE). *(This is different from CAP Theorem’s and PACELC Theorem’s ***consistency)
- I: Isolation: Serialized Transitions