Design a disk-backed KV store under contention
Company: Snowflake
Role: Software Engineer
Category: System Design
Difficulty: easy
Interview Round: Onsite
## System Design
Design a **key–value store** where:
- Values can be **very large**, so they must be stored primarily on **disk**.
- The interviewer is especially focused on how you handle **high contention** (many concurrent readers/writers, potentially hot keys).
### Requirements
Specify and design for:
- APIs: `Put(key, value)`, `Get(key)`, `Delete(key)` (optionally `CAS/CompareAndSet`).
- Durability guarantees (what is acknowledged on `Put`?).
- Concurrency: many threads/clients can call APIs simultaneously.
- Correctness expectations under concurrent access.
### What to cover
- On-disk data layout and indexing strategy.
- Caching strategy.
- Write path (including durability) and read path.
- Techniques to reduce lock contention / handle hot keys.
- How you would implement `acquire/release` locking (or alternatives).
Quick Answer: This question evaluates understanding of disk-backed key–value storage design, including durability, on-disk layout and indexing, caching, concurrency control, and techniques for managing hot-key contention.