Practice
1. In a system trace, at step 4 the circuit breaker checks the failure count before forwarding a request. What happens if the failure count exceeds the threshold at this step?
easy
Solution
Step 1: Trace circuit breaker decision at Step 4
When failure count exceeds threshold, the circuit breaker transitions to OPEN state and stops forwarding requests.Step 2: Understand behavior on open circuit
Requests are immediately failed (B), not forwarded (A), retried (C), or queued (D).Final Answer:
Option A -> Option AQuick Check:
Open circuit returns error immediately without downstream call [check]
Hint: Open circuit returns error immediately, no downstream call [OK]
Common Mistakes:
2. A search system must provide instant prefix matches for millions of users typing simultaneously, with minimal latency and no external dependencies. Which data structure is best suited to handle this requirement?
easy
Solution
Step 1: Analyze latency and dependency constraints
Elasticsearch involves network calls and disk I/O, increasing latency and external dependencies, so it's unsuitable for minimal latency prefix lookups.Step 2: Evaluate data structure suitability
A Trie provides efficient in-memory prefix matching with O(k) lookup time (k = prefix length), ideal for millions of concurrent users with minimal latency.Final Answer:
Option C -> Option CQuick Check:
Trie offers fast prefix search with no external calls [check]
Hint: Trie = fast prefix search in-memory, no network [check]
Common Mistakes:
3. If the message queue (Kafka) is unavailable during the flash sale, what exactly breaks in the order processing pipeline?
medium
Solution
Step 1: Trace Kafka's role in order processing
Kafka decouples order acceptance from inventory update; if Kafka is down, inventory update messages are lost or not sent.Step 2: Analyze failure impact
API layer (B) uses async calls, so requests don't block. Payment retries (D) are independent. Accepting orders without inventory update (C) causes overselling.Final Answer:
Option D -> Option DQuick Check:
Kafka down -> inventory updates lost -> overselling risk [check]
Hint: Kafka outage loses inventory updates causing overselling [check]
Common Mistakes:
4. You need to implement a live news feed with many clients receiving frequent updates but no client-to-server messages. Which technology is best considering scalability and simplicity?
medium
Solution
Step 1: Analyze communication pattern
Live news feed requires unidirectional server-to-client updates with many clients and no client messages.Step 2: Evaluate technology trade-offs
Server-Sent Events efficiently support unidirectional streaming with automatic reconnection and lower overhead than WebSockets. WebSockets add complexity and resource usage for no client-to-server messages. Long Polling is less efficient due to repeated HTTP requests. HTTP/2 server push is not widely supported for this use case.Final Answer:
Option B -> Option BQuick Check:
Server-Sent Events optimize unidirectional streaming with scalability [check]
Hint: Unidirectional + many clients -> Server-Sent Events [check]
Common Mistakes:
5. At 10x scale, which component of the distributed task scheduler is most likely to become the bottleneck first, and why?
hard
Solution
Step 1: Analyze cron scheduler scalability
Cron schedulers are typically lightweight and can be sharded or distributed; unlikely to bottleneck first (A).Step 2: Analyze worker node resource limits
Workers scale horizontally; CPU exhaustion (C) is mitigated by adding nodes.Step 3: Analyze network load balancer capacity
Load balancers scale with standard techniques; connection count (D) is manageable.Step 4: Analyze distributed priority queue bottlenecks
Priority queue faces contention on ordering, lease renewals, and coordination overhead, which grows non-linearly with scale, causing it to bottleneck first (B).Final Answer:
Option D -> Option DQuick Check:
Priority queue contention and lease overhead limit scale first [check]
Hint: Priority queue contention limits scale before others [check]
Common Mistakes:
