Practice
1. In a rate limiting system, at Step 3 the Service Layer checks the user's request count against its local cache. What happens if the cache TTL expires before the database updates the count?
easy
Solution
Step 1: Understand cache TTL impact
When the cache expires, the service assumes no prior usage until refreshed, allowing requests that may exceed limits.Step 2: Evaluate other options
Rejecting all requests or blocking permanently is too harsh; synchronous DB queries per request cause latency and overload.Final Answer:
Option B -> Option BQuick Check:
Expired cache -> assume zero usage -> risk over-limit [check]
Hint: Expired cache means zero usage assumed, risking breaches [check]
Common Mistakes:
2. In the search ranking system request flow, at step 3 the Ranking Component calculates BM25 scores for candidate documents. What happens if the document frequency (DF) data is stale at this step?
easy
Solution
Step 1: Understand BM25 reliance on DF
BM25 scoring depends on accurate document frequency to weigh term rarity; stale DF skews scores.Step 2: Trace impact of stale DF at Ranking Component
Ranking uses stale DF directly, leading to inaccurate relevance scores and suboptimal document ordering; no automatic fallback or query rejection occurs.Final Answer:
Option D -> Option DQuick Check:
Stale DF causes inaccurate BM25 scores and ranking errors [check]
Hint: BM25 depends on fresh DF; stale DF skews scores [check]
Common Mistakes:
3. In a distributed lock system using ZooKeeper, at step 4 the client attempts to acquire the lock by creating an ephemeral sequential node. What happens if the client crashes immediately after creating this node but before confirming lock ownership?
easy
Solution
Step 1: Understand ephemeral node semantics
Ephemeral nodes in ZooKeeper are automatically deleted when the client session ends (e.g., crash), preventing deadlocks (A) and stale locks.Step 2: Trace lock ownership after crash
Since the ephemeral node is deleted, the next client waiting for the lock will be notified, but the lock is not immediately transferred (D) until they acquire it explicitly.Final Answer:
Option A -> Option AQuick Check:
Ephemeral node deletion on client crash -> lock released [check]
Hint: Ephemeral nodes vanish on client crash, freeing locks [check]
Common Mistakes:
4. At 10x scale, which component in the job portal system is most likely to become the first bottleneck, and why?
hard
Solution
Step 1: Identify stateful components limiting scale
WebSocket servers hold persistent connections bound to server memory, limiting resharding.Step 2: Compare other components
Relational DB (A) can be scaled with sharding; search cluster (C) scales horizontally; message queues (D) can add partitions. Stateful WebSocket servers (B) face connection stickiness and memory limits first.Final Answer:
Option A -> Option AQuick Check:
Stateful WebSocket connections -> scaling bottleneck at 10x load [check]
Hint: Stateful WebSocket servers limit horizontal scaling first [check]
Common Mistakes:
5. At 10x scale, which component is most likely to fail first and why in Facebook Messenger's group chat system?
hard
Solution
Step 1: Analyze stateful components at 10x scale
Chat Servers maintain WebSocket connections bound to server memory, limiting horizontal scaling.Step 2: Compare other components
Databases and Kafka can be sharded or scaled; Redis TTL issues cause transient problems but not first failure.Final Answer:
Option A -> Option AQuick Check:
Stateful WebSocket connections -> Chat Servers bottleneck at scale [check]
Hint: Stateful WebSocket binds connections -> Chat Servers bottleneck [OK]
Common Mistakes:
