Practice
1. A social media platform needs to store user posts with high write throughput and ensure efficient retrieval by user and timestamp. Which component best handles this workload?
easy
Solution
Step 1: Identify write throughput and query pattern
The system requires high write throughput and efficient retrieval by user and timestamp, which suits wide-column stores that partition data by user ID.Step 2: Evaluate options against constraints
Relational DBs struggle with high write throughput and joins; document stores lack efficient range queries by timestamp; Redis lacks durability and is not ideal for large persistent datasets.Final Answer:
Option A -> Option AQuick Check:
Wide-column store partitions by user ID -> high write throughput and efficient user queries [check]
Hint: Partition by user ID for high write and read throughput [check]
Common Mistakes:
2. Without the automated rollback system, what exactly breaks when a misconfiguration causes a route leak?
medium
Solution
Step 1: Trace failure without rollback
Misconfigurations propagate incorrect routes; without rollback, manual detection delays fix.Step 2: Eliminate other failure modes
Silent drops (A) don't occur; automatic quarantine (C) would cause total outage, not typical; alert floods (D) don't prevent traffic misrouting.Final Answer:
Option D -> Option DQuick Check:
Manual fix delays cause prolonged incorrect routing [check]
Hint: No rollback means manual fix delays outages [check]
Common Mistakes:
3. For a distributed cache with frequent node joins and leaves, which approach best balances minimal key remapping and low client complexity?
medium
Solution
Step 1: Evaluate centralized directory approach
Centralized directory (Use a centralized directory service to map keys to nodes) adds single point of failure and latency, increasing client complexity.Step 2: Compare consistent hashing with virtual nodes
Consistent hashing with virtual nodes and client-side caching (Use consistent hashing with virtual nodes and client-side slot caching) minimizes remapping and keeps client complexity manageable.Final Answer:
Option B -> Option BQuick Check:
Consistent hashing + virtual nodes + client caching -> minimal remap, manageable complexity [check]
Hint: Consistent hashing + virtual nodes + client caching balances remap and complexity [OK]
Common Mistakes:
4. For a global API rate limiter with strict per-user limits, which architecture best balances consistency and latency?
medium
Solution
Step 1: Analyze consistency and latency needs
Strict per-user limits require consistent counters with low latency.Step 2: Evaluate architectures
Centralized Redis (A) is a bottleneck; client-side counters (C) are eventually consistent and unreliable; distributed SQL (D) has high latency. Sharded Redis with consistent hashing (B) balances load and maintains per-user consistency.Final Answer:
Option C -> Option CQuick Check:
Sharded Redis cluster scales with consistent hashing per user [check]
Hint: Shard counters by user ID for scalable consistency [check]
Common Mistakes:
5. If the Kafka cluster responsible for vote event streaming goes down, what exactly breaks in the Reddit voting system?
medium
Solution
Step 1: Understand Kafka's role in buffering vote events
Kafka buffers vote events reliably; if it fails, vote events cannot be streamed to processors.Step 2: Analyze failure impact
Vote submissions do not block immediately (Vote events cannot be buffered, causing vote submission requests to block or fail immediately wrong) because frontends can still accept votes and cache temporarily. Votes are not lost silently (Users can still vote, but votes are lost silently without any retry wrong) because Redis or other caches buffer them. UI shows stale scores due to lack of processed updates (The UI shows stale post scores but votes are queued in Redis for later processing correct). Votes continue to be processed but ranking updates become inconsistent is incorrect as votes stop flowing, not just ranking inconsistency.Final Answer:
Option B -> Option BQuick Check:
Kafka failure causes stale UI scores; votes buffered in Redis [check]
Hint: Kafka down -> stale UI, votes buffered temporarily [check]
Common Mistakes:
