Sign in to track progress, unlock prep layers, and browse your pipeline.Sign in
System Design: Disk-Backed Key-Value Store Under Contention
Design a key-value store with the following characteristics:
Core Requirements
- Large Values: Values can be very large and must be stored primarily on disk.
- High Contention: The system must efficiently handle many concurrent readers and writers, including scenarios with "hot keys" experiencing disproportionately high access rates.
API Specification
The store must expose the following APIs:
Put(key, value): Inserts or updates a key-value pair.Get(key): Retrieves the value associated with a given key.Delete(key): Removes a key-value pair.CAS(key, expectedValue, newValue): (Optional) Atomically compares the current value associated with a key toexpectedValueand, if they match, updates it tonewValue.
Design Considerations
Your design should explicitly address and specify:
- Durability Guarantees: Define what constitutes an "acknowledged"
Putoperation from a durability perspective. - Concurrency Model: Detail how the system handles simultaneous API calls from multiple threads or clients.
- Correctness: Explain the correctness expectations and guarantees under concurrent access (e.g., consistency models).
Areas to Cover in Your Design
Be prepared to discuss:
- On-disk data layout and indexing strategies.
- Caching mechanisms to improve performance.
- Detailed descriptions of the write path (including durability aspects) and the read path.
- Techniques to mitigate lock contention and manage hot keys effectively.
- Implementation details for concurrency control, such as locking primitives (
acquire/release) or alternative synchronization methods.
AI interview prep
Core dilemma
Balancing the inherent slowness and durability requirements of disk-backed storage for potentially large values with the need for high throughput and low latency, especially under extreme contention and with hot keys.
Mid-level signals3
Senior signals3
Red flags3
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
System Design: Disk-Backed Key-Value Store Under Contention
Design a key-value store with the following characteristics:
Core Requirements
- Large Values: Values can be very large and must be stored primarily on disk.
- High Contention: The system must efficiently handle many concurrent readers and writers, including scenarios with "hot keys" experiencing disproportionately high access rates.
API Specification
The store must expose the following APIs:
Put(key, value): Inserts or updates a key-value pair.Get(key): Retrieves the value associated with a given key.Delete(key): Removes a key-value pair.CAS(key, expectedValue, newValue): (Optional) Atomically compares the current value associated with a key toexpectedValueand, if they match, updates it tonewValue.
Design Considerations
Your design should explicitly address and specify:
- Durability Guarantees: Define what constitutes an "acknowledged"
Putoperation from a durability perspective. - Concurrency Model: Detail how the system handles simultaneous API calls from multiple threads or clients.
- Correctness: Explain the correctness expectations and guarantees under concurrent access (e.g., consistency models).
Areas to Cover in Your Design
Be prepared to discuss:
- On-disk data layout and indexing strategies.
- Caching mechanisms to improve performance.
- Detailed descriptions of the write path (including durability aspects) and the read path.
- Techniques to mitigate lock contention and manage hot keys effectively.
- Implementation details for concurrency control, such as locking primitives (
acquire/release) or alternative synchronization methods.