Practice
1. In the newsfeed system, at Step 4 the Delivery Worker reads a fan-out event from Kafka and attempts to deliver it to followers. What happens if a follower's device is offline at this step?
easy
Solution
Step 1: Trace Delivery Worker behavior at Step 4
The Delivery Worker reads fan-out events from Kafka and attempts delivery. If the follower is offline, immediate retry (A) would block and reduce throughput. Dropping messages (C) causes data loss. Pushing directly to device cache (D) is impossible if offline.Step 2: Understand retry mechanism
The system marks the message as sent but not delivered, queues it for retry later when the follower reconnects, ensuring eventual delivery without blocking.Final Answer:
Option A -> Option AQuick Check:
Offline followers cause queued retries, not immediate blocking [check]
Hint: Offline followers cause queued retries, not immediate blocking [check]
Common Mistakes:
2. Without the message queue (Kafka) in the architecture, what exactly breaks when Alice sends a message to Bob during a partial regional outage?
medium
Solution
Step 1: Understand Kafka's role in decoupling
Kafka buffers messages asynchronously, preventing blocking and enabling retries during outages.Step 2: Analyze failure without Kafka
Without Kafka, synchronous calls block sender until receiver responds; if receiver crashes, message is lost with no retry (B). However, buffering on client (C) is incorrect as buffering is server-side.Final Answer:
Option A -> Option AQuick Check:
No Kafka -> synchronous send blocks and message loss on receiver crash [check]
Hint: No Kafka -> send blocks, no retry, message lost on crash [check]
Common Mistakes:
3. For the Explore page, you must recommend trending photos to users with low latency and high freshness. Which architecture best fits this constraint?
medium
Solution
Step 1: Analyze freshness and latency requirements
Trending photos must be updated with low latency and high freshness, ruling out long batch intervals.Step 2: Evaluate architectures
Batch jobs every 6 hours (A) are too stale. Client polling (C) adds load and latency. CDN cache invalidation (D) is coarse-grained and slow. Streaming pipeline (B) updates trending scores in real-time and stores in fast KV store, meeting freshness and latency.Final Answer:
Option D -> Option DQuick Check:
Streaming pipeline enables real-time trending updates [check]
Hint: Real-time streaming pipelines enable fresh trending data [check]
Common Mistakes:
4. If the message queue (e.g., Kafka) between the upload service and transcoding pipeline fails, what exactly breaks in the video processing flow?
medium
Solution
Step 1: Trace failure impact of message queue outage
The queue decouples upload and transcoding. Without it, upload service cannot enqueue transcoding jobs. Uploads succeed but transcoding workers receive no tasks, so no processed videos are generated. Blocking upload (B) is incorrect because upload is asynchronous. Duplicate transcoding (A) is unrelated. View count errors (D) happen downstream, not due to queue failure.Step 2: Confirm exact failure mode
Uploads accepted but stuck before transcoding is the precise failure.Final Answer:
Option A -> Option AQuick Check:
Queue failure causes transcoding jobs to be lost, no processed videos [check]
Hint: Queue failure means no transcoding jobs dispatched [check]
Common Mistakes:
5. At 10x scale, which component is most likely to become the bottleneck first in a read-heavy CQRS system with read replicas, and why?
hard
Solution
Step 1: Analyze scaling impact on components
Write volume and event propagation increase 10x, stressing the event queue.Step 2: Compare bottlenecks
Primary DB writes scale with writes, not reads; read replicas scale horizontally; client caches don't cause exponential invalidation.Final Answer:
Option A -> Option AQuick Check:
Event queue overwhelmed first due to write event surge [check]
Hint: Event queue chokes first as write events surge 10x [check]
Common Mistakes:
