How it works
A key-value store associates a unique key with an opaque value, meaning the store keeps the bytes without interpreting them. Its core operations are put(key, value) and get(key). Deletion, conditional writes, expiration, and listing are separate product decisions. Direct lookup by known key is its strength; joins or filtering across values need another index or data model.
Agree on key and value sizes, volume, read/write mix, latency, availability, durability (whether an acknowledged write survives a crash), and whether a read must reflect the latest acknowledged write. Numbers turn that list into decisions. As an example, 2 billion keys at 1 KB each is 2 TB before copies, or 6 TB with three copies. If one node comfortably holds 1 TB, that is at least six nodes for storage alone, and each lost node leaves up to 1 TB to rebuild.
A one-machine hash table is a useful first model, and for many products it is enough: a single Redis server with a standby can carry plenty of cache and session traffic. A data set larger than one machine, or a promise to survive machine failure, forces distribution and recovery into the contract. If you expect ad hoc queries across values, a relational database is likely the better start. DynamoDB shows the usual compromise: fast access by key, with secondary indexes as extra structures that cost storage and write work.
Orders are stored by order ID, but a team also needs all late orders in a region. What would you clarify?
Direct order-ID lookup fits a key-value API. Late orders by region need a maintained secondary index or a query-oriented store; scanning every opaque value is not a scalable substitute.
Use this as a guide for self review; written answers are not graded.Keep in mind
- A key identifies an opaque value; the access pattern drives the design.
- Specify durability, failure, and read-after-write expectations before choosing machinery.