Practice
1. In the News Feed system, at step 4 the Delivery Worker reads from the fan-out queue to push updates to followers. What happens if the follower's cache entry for the feed is expired at this step?
easy
Solution
Step 1: Trace Delivery Worker decision at Step 4 -- follower cache TTL expired
If the cache is expired, the Delivery Worker must fetch fresh data to ensure the follower receives the latest feed snapshot.Step 2: Evaluate other options
Skipping (A) causes missed updates; retrying without cache update (C) delays delivery; sending stale data (D) violates freshness guarantees.Final Answer:
Option A -> Option AQuick Check:
Expired cache triggers DB fetch for fresh feed [check]
Hint: Expired cache triggers DB fetch before delivery [check]
Common Mistakes:
2. A web API needs to enforce a rate limit of 100 requests per minute per user, allowing bursts but avoiding sudden resets at minute boundaries. Which rate limiting approach best fits this requirement?
easy
Solution
Step 1: Identify burst tolerance and smooth rate enforcement
Fixed window counters reset abruptly at minute boundaries, causing spikes. Token and leaky buckets enforce steady rates but may not track exact recent usage.Step 2: Sliding window counters track requests continuously over the last 60 seconds, allowing bursts without sudden resets
Sliding window counters provide smoother rate limiting by considering recent activity, avoiding boundary effects.Final Answer:
Option B -> Option BQuick Check:
Sliding window smooths rate limits over time, avoiding fixed window spikes [check]
Hint: Sliding window smooths counts over time, fixed resets abruptly [check]
Common Mistakes:
3. In the metrics collection system, at step 4 the Aggregation Worker receives a batch of metrics from Kafka. What happens if the Aggregation Worker detects a missing metric timestamp in this batch?
easy
Solution
Step 1: Aggregation Worker error handling
Discarding entire batch (A) or pausing (C) causes unnecessary delays; default timestamps (D) risk data corruption.Step 2: Skipping invalid metrics
Skipping only the invalid metric preserves throughput and data integrity for valid metrics.Final Answer:
Option A -> Option AQuick Check:
Skip invalid metrics, process valid batch entries [check]
Hint: Skip bad metrics, keep batch flowing smoothly [check]
Common Mistakes:
4. For a CDN serving frequently updated dynamic content, which origin content delivery strategy is best to ensure freshness without overloading the origin server?
medium
Solution
Step 1: Analyze push vs pull for dynamic content freshness
Push model can overload origin with frequent updates; polling adds unnecessary load.Step 2: Evaluate pull with TTL caching
Pull with TTL balances freshness and origin load by caching briefly and refreshing on expiry.Final Answer:
Option A -> Option AQuick Check:
Pull with TTL caching balances freshness and origin load [check]
Hint: Pull with TTL balances freshness and load [check]
Common Mistakes:
5. Without the retry queue component, what exactly breaks in the webhook delivery system when a subscriber's endpoint is temporarily unreachable?
medium
Solution
Step 1: Understand retry queue role
The retry queue buffers failed deliveries to preserve order by retrying later.Step 2: Trace failure without retry queue
Without it, subsequent events may be sent immediately, causing out-of-order delivery.Final Answer:
Option D -> Option DQuick Check:
No retry queue -> out-of-order delivery possible [check]
Hint: No retry queue -> ordering breaks on failures [check]
Common Mistakes:
