Practice
1. During a flash sale, the system must handle sudden bursts of 10x traffic within 60 seconds, ensuring order preservation of purchase requests per user session. Which component best handles this requirement?
easy
Solution
Step 1: Identify ordering requirement per user session
Kafka partitions keyed by user session ID guarantee ordering within that partition, ensuring requests are processed sequentially per user.Step 2: Evaluate alternatives
Relational DB row-level locking (A) causes high contention and poor scalability under 10x burst. Redis (C) lacks strong ordering guarantees and durability. Load balancer (D) only distributes load but does not preserve order.Final Answer:
Option C -> Option CQuick Check:
Kafka partition key -> per-session ordering guaranteed [check]
Hint: Kafka partitions preserve order per key [check]
Common Mistakes:
2. In the faceted search request flow, at Step 4 the Query Coordinator merges partial results from multiple shard nodes. What happens if one shard node responds with a partial result missing some facet counts due to a timeout?
easy
Solution
Step 1: Understand Query Coordinator's merge logic
The coordinator merges partial results from all shards; if a shard times out, its data is excluded to avoid blocking the entire query.Step 2: Eliminate other options
Returning an error breaks availability; marking missing facets as zero is inaccurate; synchronous retries would increase latency.Final Answer:
Option A -> Option AQuick Check:
Timeout shard data excluded -> partial but available results [check]
Hint: Timeout shards excluded to keep query latency low [check]
Common Mistakes:
3. A web service receives highly variable traffic with some clients opening many simultaneous connections, while others open few. Which load balancing algorithm best distributes load evenly across servers?
easy
Solution
Step 1: Understand traffic variability
Clients open varying numbers of connections, so servers can become unevenly loaded if requests are assigned blindly.Step 2: Evaluate load balancing algorithms
Round Robin ignores current load, IP Hash pins clients to servers (may cause imbalance), Weighted Round Robin uses static weights ignoring dynamic load. Least Connections dynamically balances based on active connections.Final Answer:
Option D -> Option DQuick Check:
Least Connections adapts to real-time load, balancing uneven client connections [check]
Hint: Least Connections adapts to active load, not just request count [check]
Common Mistakes:
4. You must design a distributed cache for a social media feed that tolerates network partitions and prioritizes availability over strict ordering. Which consistency model and architecture combination best fits this scenario?
medium
Solution
Step 1: Analyze availability and partition tolerance needs
Eventual consistency with asynchronous replication maximizes availability during partitions, tolerating temporary inconsistencies.Step 2: Compare with other models
Strong consistency blocks during partitions; causal consistency adds overhead and complexity not needed here; read-your-writes focuses on client guarantees, not global availability.Final Answer:
Option A -> Option AQuick Check:
Eventual consistency favors availability and partition tolerance [check]
Hint: Eventual consistency maximizes availability during partitions [check]
Common Mistakes:
5. At 10x scale, which component in a Redis system using Bloom filters to speed up key existence checks is most likely to fail first, and why?
hard
Solution
Step 1: Identify Bloom filter memory scaling
Bloom filters require memory proportional to keyspace size; at 10x scale, memory usage grows and may exceed RAM limits.Step 2: Trace failure impact
When memory is insufficient, Bloom filters evict bits or reduce size, increasing false positive rates, which causes more disk lookups and degrades performance.Step 3: Evaluate other components
Network bandwidth and client cache inconsistencies are less likely first failures; disk subsystem is affected secondarily.Final Answer:
Option C -> Option CQuick Check:
Bloom filter memory limits cause false positive spikes at scale [check]
Hint: Bloom filter memory hits RAM limit first at scale [check]
Common Mistakes:
