Practice
1. In a primary-replica replication system, at step 4 the replica receives a batch of write-ahead log entries from the primary. What is the replica's exact state after applying these entries?
easy
Solution
Step 1: Trace replica behavior at step 4
Replica applies WAL entries to its local store to catch up with primary.Step 2: Understand acknowledgment timing
Replica acknowledges primary only after applying entries to ensure durability and consistency.Final Answer:
Option B -> Option BQuick Check:
Replica applies then acknowledges -> ensures data durability [check]
Hint: Apply WAL entries before ack -> durability ensured [check]
Common Mistakes:
2. In the message delivery trace, at Step 4 the Delivery Worker checks Bob's presence TTL in the presence service cache. What happens if Bob's presence TTL has expired at this step?
easy
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]
Hint: Expired presence TTL means offline -> queue message [check]
Common Mistakes:
3. A distributed messaging system must handle 1 million writes per second and guarantee message durability despite node failures. Which component best handles this requirement?
easy
Solution
Step 1: Identify durability and high write throughput needs
Redis without persistence (A) cannot guarantee durability on failure. Relational DB (C) cannot handle 1M writes/sec synchronously without bottlenecks. Simple queue without replication (D) risks message loss.Step 2: Recognize Kafka's replication and partitioning
Kafka provides durable, replicated logs with partitioning for high throughput and fault tolerance.Final Answer:
Option A -> Option AQuick Check:
Kafka replication + partitioning -> durability and scale [check]
Hint: Kafka replicates logs for durability and scales with partitions [check]
Common Mistakes:
4. 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:
5. At 10x scale, which component in a synchronous chat system is most likely to fail first and why?
hard
Solution
Step 1: Identify stateful bottleneck in synchronous chat
Chat servers maintain WebSocket connections statefully, binding clients to specific servers.Step 2: Analyze scaling challenges
At 10x scale, resharding or migrating these stateful connections is complex, causing chat servers to fail first.Final Answer:
Option D -> Option DQuick Check:
Stateful WebSocket servers limit horizontal scaling, causing early failure [check]
Hint: Stateful WebSocket servers bottleneck synchronous chat scaling [check]
Common Mistakes:
