Practice
1. You must design a high-throughput OLTP system that requires strong consistency but can tolerate some delay in durability guarantees. Which approach is best suited?
medium
Solution
Step 1: Analyze consistency and durability trade-offs
Strong consistency requires strict serializable isolation; durability can be delayed to improve throughput.Step 2: Evaluate replication and isolation options
Asynchronous replication with strict serializable isolation fits the requirement, allowing durability delay without sacrificing consistency.Final Answer:
Option A -> Option AQuick Check:
Async replication + strict serializable -> strong consistency, delayed durability [check]
Hint: Strong consistency needs strict isolation, durability can lag [check]
Common Mistakes:
2. If the Kafka cluster is unavailable, what exact failure occurs in the notification system's delivery path?
medium
Solution
Step 1: Trace failure impact of Kafka unavailability
Kafka unavailability blocks producers or causes retries; delivery workers cannot fetch messages from Kafka.Step 2: Evaluate fallback mechanisms
In a robust design, a backup queue or dead-letter queue is used to avoid message loss; synchronous HTTP fallback (D) is not automatic; silent loss (A) is unacceptable.Final Answer:
Option C -> Option CQuick Check:
Backup queue prevents message loss during Kafka downtime [check]
Hint: Backup queue prevents loss when Kafka is down [check]
Common Mistakes:
3. Without the consistent hashing ring metadata, what exactly breaks in a distributed cache system when a client requests a key?
medium
Solution
Step 1: Role of consistent hashing ring metadata
The ring metadata maps keys to nodes; without it, nodes cannot route requests correctly, leading to inconsistent data placement.Step 2: Consequence of missing ring metadata
Without this metadata, nodes lose synchronization on key ownership, causing data corruption as writes go to wrong nodes; request failure (The cache node receiving the request cannot determine the correct node, causing request failure or indefinite retry) is secondary, and fallback (The system falls back to a centralized database for all requests, increasing latency) is not automatic.Final Answer:
Option A -> Option AQuick Check:
Missing ring metadata causes data corruption due to lost key-node mapping [check]
Hint: No ring metadata -> lost key-node mapping -> data corruption [check]
Common Mistakes:
4. At 10x traffic scale during a flash sale, which component is most likely to fail first and why?
hard
Solution
Step 1: Identify stateful components under load
API Gateway maintains user session state (e.g., WebSocket connections), which are sticky and stateful, limiting horizontal scaling.Step 2: Compare other components
Relational DB (A) can be sharded; cache (C) TTL floods are mitigated by pre-warming; inventory locking (D) is optimized with partitioning. API Gateway statefulness causes connection limits and bottlenecks first.Final Answer:
Option B -> Option BQuick Check:
API Gateway stateful sessions limit horizontal scaling [check]
Hint: Stateful API Gateway limits scaling under 10x load [check]
Common Mistakes:
5. At 10x scale, which component in the News Feed system is most likely to fail first and why?
hard
Solution
Step 1: Analyze bottlenecks at 10x scale
Database (A) can be sharded; cache (C) scales horizontally; Kafka (D) can add partitions but has limits.Step 2: Delivery Workers face exponential fan-out growth
Fan-out queues grow with followers; Delivery Workers must push updates to millions more followers, causing processing lag and backlog.Final Answer:
Option B -> Option BQuick Check:
Delivery Workers bottleneck due to fan-out processing load [check]
Hint: Delivery Workers bottleneck on fan-out processing at scale [check]
Common Mistakes:
