Practice
1. You need a storage system for a database requiring low-latency random reads/writes and strong consistency. Which storage type is best and why?
medium
Solution
Step 1: Identify storage needs for low-latency random access and strong consistency
Databases require fast block-level access with strong consistency for transactional integrity.Step 2: Evaluate storage types
Block storage offers raw device access with low latency and strong consistency; object storage is optimized for throughput and eventual consistency; file storage adds overhead and less suited for random writes; tape is offline archival.Final Answer:
Option A -> Option AQuick Check:
Block storage = low latency + strong consistency [check]
Hint: Block storage = low latency + strong consistency for DBs [check]
Common Mistakes:
2. If the Bloom filter's hash functions are not independent and produce correlated outputs, what is the exact failure mode observed?
medium
Solution
Step 1: Understand hash function independence role
Independent hash functions distribute bits uniformly; correlated hashes cause clustering.Step 2: Trace effect of correlated hashes
Correlated hashes set overlapping bits, saturating the bit array faster, increasing false positives and reducing filter effectiveness.Final Answer:
Option A -> Option AQuick Check:
Correlated hashes cause bit array saturation, raising false positives [check]
Hint: Correlated hashes cause bit array saturation and false positives [check]
Common Mistakes:
3. If the message queue (Kafka) is unavailable during the flash sale, what exactly breaks in the order processing pipeline?
medium
Solution
Step 1: Trace Kafka's role in order processing
Kafka decouples order acceptance from inventory update; if Kafka is down, inventory update messages are lost or not sent.Step 2: Analyze failure impact
API layer (B) uses async calls, so requests don't block. Payment retries (D) are independent. Accepting orders without inventory update (C) causes overselling.Final Answer:
Option D -> Option DQuick Check:
Kafka down -> inventory updates lost -> overselling risk [check]
Hint: Kafka outage loses inventory updates causing overselling [check]
Common Mistakes:
4. If the Kafka cluster responsible for fan-out message delivery crashes, what is the exact failure observed in the News Feed system?
medium
Solution
Step 1: Understand Kafka's role in fan-out delivery
Kafka acts as a durable queue for fan-out messages. If it crashes, Delivery Workers cannot fetch new messages, causing stale feeds.Step 2: Evaluate failure modes
Posts are not lost immediately (A) due to Kafka's durability; writes are asynchronous so no blocking (B); duplicates (D) occur only on replay, not crash.Final Answer:
Option D -> Option DQuick Check:
Kafka crash stalls delivery, causing stale feeds [check]
Hint: Kafka crash stalls delivery, causing stale feeds [check]
Common Mistakes:
5. At 10x current scale, which component is most likely to fail first in Instagram's real-time feed delivery, and why?
hard
Solution
Step 1: Identify stateful components limiting scale
WebSocket servers maintain persistent connections per user, which are stateful and bound to server memory.Step 2: Analyze scaling challenges
At 10x scale, adding servers doesn't migrate existing WebSocket connections, causing uneven load and resource exhaustion. Relational DB (A) can be sharded, cache (B) can be scaled with TTL tuning, storage (D) scales with cloud object storage.Final Answer:
Option C -> Option CQuick Check:
Stateful WebSocket connections limit horizontal scaling [check]
Hint: Stateful WebSocket servers bottleneck horizontal scaling [check]
Common Mistakes:
