Practice
Solution
Step 1: Identify the role of the message queue
Kafka provides durable, partitioned logs that decouple producers from consumers, enabling high write throughput and ordered delivery per user.Step 2: Evaluate other options
Relational DB polling (A) can't handle 1M writes/sec efficiently; Redis (C) lacks durability and persistence guarantees; synchronous HTTP (D) blocks on delivery and doesn't scale.Final Answer:
Option D -> Option DQuick Check:
Kafka partitions by user ID -> durable, ordered fan-out [check]
Solution
Step 1: Trace cache invalidation at step 4
Cache invalidation is asynchronous and best-effort; failure does not rollback DB writes.Step 2: Understand failure impact on cache state
If invalidation fails, Redis cache remains stale until TTL expiry or next explicit refresh.Final Answer:
Option C -> Option CQuick Check:
Failed cache invalidation -> stale cache until TTL or manual refresh [check]
Solution
Step 1: Identify durability and high write throughput needs
In-memory queues with snapshots (A) risk data loss on crash; Redis without persistence (C) loses data on restart; synchronous DB writes (D) block producers and limit throughput.Step 2: Evaluate Kafka's distributed log
Kafka partitions topics for parallelism and persists data durably on disk, allowing high throughput and crash recovery without blocking producers.Final Answer:
Option B -> Option BQuick Check:
Kafka partitions + durable log -> high throughput + durability [check]
Solution
Step 1: Understand absence of bulkhead isolation
Without bulkheads, saturation causes blocking (B) and thread starvation, but automatic rejection (C) is a bulkhead feature. Queuing indefinitely (A) is unlikely without bulkheads. Load balancers (D) don't detect internal resource saturation.Step 2: Trace failure impact
Without bulkheads, blocking threads cause cascading failures; with bulkheads, requests are rejected to contain blast radius.Final Answer:
Option C -> Option CQuick Check:
Without bulkheads, blocking causes cascading failures [check]
Solution
Step 1: Analyze Redis cache behavior under 10x load
Increased load causes Redis memory pressure, triggering eviction storms and latency spikes.Step 2: Compare Redis failure risk to DynamoDB and other components
DynamoDB scales well with partitioning; network and app servers scale horizontally; Redis memory is stateful and harder to scale quickly.Final Answer:
Option A -> Option AQuick Check:
Redis memory pressure -> eviction storms -> latency spikes first at scale [check]
