Practice
1. A food delivery system must efficiently match nearby drivers to new orders in real-time, minimizing latency and ensuring fairness. Which component is best suited to handle this driver assignment under high load?
easy
Solution
Step 1: Identify driver assignment requirements
Real-time, low-latency matching requires fast spatial queries and event-driven updates.Step 2: Evaluate component suitability
Relational DBs with spatial indexes (A) are too slow for high write/read concurrency; batch jobs (C) introduce unacceptable delay; client-side filtering (D) is inefficient and inconsistent.Final Answer:
Option D -> Option DQuick Check:
Distributed in-memory geospatial index with pub/sub -> real-time, scalable driver assignment [check]
Hint: In-memory geospatial + pub/sub for real-time driver matching [check]
Common Mistakes:
2. A social media platform must handle 1 million new posts per second and fan-out updates to millions of followers asynchronously. Which component is best suited to decouple the high write throughput from the fan-out delivery process?
easy
Solution
Step 1: Identify the need for decoupling writes and fan-out
Relational DB triggers (A) cause synchronous blocking and don't scale to 1M writes/sec. Redis (C) is fast but lacks durability and ordering guarantees for fan-out. Polling (D) adds latency and load on clients.Step 2: Evaluate Kafka for asynchronous, durable, partitioned messaging
Kafka partitions by user ID to preserve ordering per user and decouples writes from fan-out delivery, handling high throughput efficiently.Final Answer:
Option C -> Option CQuick Check:
Kafka partitions enable scalable, ordered fan-out delivery [check]
Hint: Kafka partitions decouple writes and preserve ordering [check]
Common Mistakes:
3. In the request flow, at Step 4 the CDN edge server checks its cache for the requested asset. What happens if the asset is not found in the cache?
easy
Solution
Step 1: Trace CDN cache miss handling at Step 4
When the asset is missing in the edge cache, the CDN must retrieve it from the origin server.Step 2: Confirm CDN forwards request to origin server for fresh content
The CDN edge server acts as a proxy, fetching the asset from origin to serve the client.Final Answer:
Option D -> Option DQuick Check:
Cache miss triggers origin fetch, not error or redirect [check]
Hint: Cache miss -> fetch from origin server, not error or redirect [OK]
Common Mistakes:
4. For propagating trace context across asynchronous messaging systems, which approach best preserves trace continuity without coupling services tightly?
medium
Solution
Step 1: Understand asynchronous trace context propagation
Embedding trace context in message metadata headers leverages messaging system features to propagate context without modifying payload or tight coupling.Step 2: Evaluate other options
HTTP headers don't exist in messaging protocols. Centralized DB lookup adds latency and coupling. Generating new trace IDs breaks trace continuity and requires complex offline correlation.Final Answer:
Option A -> Option AQuick Check:
Message metadata headers preserve trace context asynchronously [check]
Hint: Use message metadata headers, not payload or DB lookup [OK]
Common Mistakes:
5. Without the event store (Kafka) in the system, what exactly breaks during command processing?
medium
Solution
Step 1: Identify event store role in command processing
The event store (Kafka) durably persists events and decouples command processing from read model updates.Step 2: Trace failure without event store
Without Kafka, commands have no durable event persistence, causing silent failures as events are lost without notification.Final Answer:
Option C -> Option CQuick Check:
No event store -> commands lost silently, no durability [check]
Hint: No event store -> silent command loss, no durability [check]
Common Mistakes:
