How would you design a distributed key-value store like DynamoDB?
Answer
Architecture: consistent hashing for partitioning, virtual nodes for load balance. Replication: configurable N replicas per key, quorum reads/writes (W+R>N for consistency). Conflict resolution: vector clocks + application-specified resolution, or last-write-wins. Storage engine: LSM tree for write optimization (in-memory + SSTables). Operations: get, put, delete with conditional operations (compare-and-swap). Consistency: tunable (eventual to strong via quorum). Failure handling: hinted handoff, anti-entropy with Merkle trees. Scale: add nodes, automatic rebalancing. Features: secondary indexes (local or global), TTL, transactions (Dynamo-style). CAP: AP by default, CP possible with strict quorum.
Master These Concepts with IIT Certification
175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.