Design a Key Value Store

Overview A key-value store (key-value database) is a non-relational database Unique identifier keys can be plain text or hashed value Short keys are more performant than longer keys Values can be strings, lists, or objects, etc Values are usually treated as opaque objects in Amazon Dynamo DB, Memcached, Redis. (Opaque objects are not coded to interfaces) Key-value stores support the following operations: put(key, value) get(key) Scope Keep key size small: less than 10 KB Large storage capacity High availability Automatic scaling (add / remove servers) Tunable consistency Low latency Single server architecture A single server key-value store can be implemented with an in memory hash map Optimization: Compress data Keep frequently used data in memory and store the rest on disc A single server key-value store cannot be scaled to support big data Distributed architecture A distributed key-value store is also called a distributed hash table CAP theorem & distributed systems According to the CAP Theorem, a distributed system can only achieve two of the following properties:...

December 19, 2022 · 10 min · 2055 words · Me