Practice
1. A system needs to quickly check membership of millions of items with minimal memory and can tolerate some false positives but no false negatives. Which component best handles this requirement?
easy
Solution
Step 1: Identify membership check requirements
The system requires fast membership queries with minimal memory and can tolerate false positives but not false negatives.Step 2: Match component capabilities
Bloom filters use multiple hash functions and a bit array to provide space-efficient membership checks with false positives but no false negatives, fitting the scenario.Final Answer:
Option D -> Option DQuick Check:
Bloom filter trades memory for false positives, no false negatives [check]
Hint: Bloom filters trade memory for false positives [check]
Common Mistakes:
2. A system must track millions of concurrent video playbacks and update user progress in near real-time without blocking the video stream. Which component is best suited to handle progress updates asynchronously?
easy
Solution
Step 1: Identify asynchronous progress update requirement
Relational DB synchronous writes (Use a relational database with synchronous writes on every video event) block video playback and don't scale well for millions of concurrent updates.Step 2: Evaluate buffering and decoupling
Message queue (Use a message queue to buffer progress update events for asynchronous processing) decouples video playback from progress persistence, enabling scalable asynchronous processing.Final Answer:
Option A -> Option AQuick Check:
Message queue buffers progress updates for async processing [check]
Hint: Buffer updates asynchronously with message queue [OK]
Common Mistakes:
3. In the photo feed generation flow, at step 4 the Feed Worker fetches stories from the Stories Service cache. What happens if the cache TTL for a user's stories has expired at this step?
easy
Solution
Step 1: Trace Feed Worker behavior at cache miss
When TTL expires, the cache is stale. The Feed Worker must avoid blocking feed generation.Step 2: Understand asynchronous cache refresh
To maintain low latency, the Feed Worker returns empty stories immediately and triggers async cache refresh. Blocking fetch (B) would increase latency. Returning stale data (A) risks outdated content. Skipping stories silently (C) loses user experience.Final Answer:
Option A -> Option AQuick Check:
Async cache refresh avoids blocking feed generation [check]
Hint: Async cache refresh avoids blocking feed generation [OK]
Common Mistakes:
4. A load balancer must detect unhealthy backend servers and reroute traffic without client impact. Which component is primarily responsible for detecting server health status?
easy
Solution
Step 1: Identify health detection responsibility
The health check module actively probes backend servers to determine their health status.Step 2: Eliminate other options
DNS resolver changes are slow and indirect; session persistence caches track sessions, not health; client-side retries do not detect server health.Final Answer:
Option A -> Option AQuick Check:
Health check module probes servers directly for health [check]
Hint: Health checks probe servers directly to detect failures [check]
Common Mistakes:
5. For a system launching with unpredictable hot keys, which cache warming strategy balances freshness and resource usage best?
medium
Solution
Step 1: Analyze warming strategies for unpredictable hot keys
Hybrid approach uses historical and real-time data to adaptively warm relevant keys.Step 2: Eliminate extremes
Preloading all keys wastes resources; ignoring recent changes misses new hot keys; lazy loading causes latency.Final Answer:
Option A -> Option AQuick Check:
Hybrid warming adapts to traffic changes balancing freshness and cost [check]
Hint: Hybrid warming adapts to traffic changes balancing freshness and cost [check]
Common Mistakes:
