Practice
Solution
Step 1: Identify decoupling need
Immediate consistency via relational DB (A relational database with strong ACID transactions for immediate consistency) blocks on writes, causing latency spikes. In-memory cache (An in-memory cache with TTL eviction to buffer incoming orders) lacks durability and ordering guarantees. API gateway throttling (A REST API gateway that throttles requests to downstream services) limits throughput but doesn't decouple processing.Step 2: Durable queue with partitioning
A distributed message queue (A distributed message queue with partitioning and durable storage) buffers spikes, partitions workload, and guarantees durability, enabling asynchronous downstream processing.Final Answer:
Option C -> Option CQuick Check:
Distributed queue partitions spikes, ensures durability, decouples processing [check]
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]
Solution
Step 1: Understand recovery trade-offs
Immediate re-advertisement (A) risks routing loops and instability; static routes (C) don't scale globally; client retries (D) don't fix routing issues.Step 2: Evaluate gradual reintroduction
Route flap damping (B) prevents rapid route changes causing instability, balancing speed and safety during recovery.Final Answer:
Option A -> Option AQuick Check:
Route flap damping prevents loops during gradual route restoration [check]
Solution
Step 1: Analyze false negative tolerance
Bloom filters have zero false negatives but allow false positives, so exact checks need backend confirmation.Step 2: Evaluate approaches
Only Bloom filter (A) risks false positives causing incorrect hits. Distributed cache (C) is costly at scale. Counting Bloom filters (D) track counts but still have false positives and complexity.Final Answer:
Option D -> Option DQuick Check:
Bloom filter filters negatives; backend confirms positives for exactness [check]
Solution
Step 1: Analyze scale impact on components
Global aggregator (A) merges asynchronously, so less likely bottleneck. Replication overhead (C) grows but can be optimized. Client counters (D) can compact state.Step 2: Identify shard replicas failure mode
At 10x scale, network partitions increase, causing shards to diverge permanently without reconciliation, breaking eventual consistency.Final Answer:
Option A -> Option AQuick Check:
Network partitions cause shard divergence first at scale [check]
