Practice
Solution
Step 1: Trace Delivery Worker decision at Step 4 -- Bob's presence TTL
If Bob's presence TTL expired, Delivery Worker treats Bob as offline and queues message for offline storage.Step 2: Eliminate other options
Marking delivered without sending is incorrect; retrying indefinitely blocks delivery; sending regardless ignores offline status.Final Answer:
Option A -> Option AQuick Check:
Expired presence TTL -> queue for offline delivery [check]
Solution
Step 1: Identify the need for decoupling writes from fan-out
Handling 1 million writes per second with synchronous fan-out is not feasible on a single machine or direct calls.Step 2: Evaluate components for asynchronous buffering
Kafka provides durable, partitioned logs that buffer writes and allow scalable asynchronous delivery. Relational DBs can't handle this write load synchronously. Redis lacks durability guarantees for this scale. Direct HTTP calls block and don't scale.Final Answer:
Option D -> Option DQuick Check:
Kafka buffers writes asynchronously, enabling high write throughput [check]
Solution
Step 1: Role of Kafka in decoupling send and delivery
Kafka buffers messages asynchronously, preventing sender blocking on recipient availability.Step 2: Consequence of removing Kafka
Sender must synchronously wait for recipient response; if recipient crashes, message is lost with no retry.Final Answer:
Option A -> Option AQuick Check:
No queue causes synchronous blocking and message loss on recipient failure [check]
Solution
Step 1: Understand Kafka's role in event streaming
Kafka buffers and reliably delivers connection events to downstream services asynchronously.Step 2: Trace failure impact
If Kafka is down, writes to Kafka fail but connection requests may still be accepted at the API layer; however, downstream consumers do not get updates, causing stale graph state.Final Answer:
Option D -> Option DQuick Check:
Kafka down -> downstream stale, no immediate request loss [check]
Solution
Step 1: Identify stateful bottleneck at scale
Chat servers maintain stateful WebSocket connections bound to server memory, making resharding difficult at 10x scale.Step 2: Compare other components
Databases (A) can be scaled with sharding and caching; message queues (C) can add partitions; load balancers (D) scale horizontally more easily.Final Answer:
Option D -> Option DQuick Check:
Stateful WebSocket servers -> first bottleneck at 10x scale [check]
