Practice
Solution
Step 1: Identify the decoupling requirement
Relational DB with row-level locking (Use a relational database with row-level locking to queue messages) cannot handle 1M writes/sec due to locking and durability overhead. Redis (Use Redis as an in-memory queue with TTL for message expiration) lacks durability guarantees and TTL causes message loss risk. Direct synchronous calls (Use direct synchronous HTTP calls from sender to all recipients) block sender and don't scale.Step 2: Evaluate Kafka's suitability
Kafka partitions by conversation ID ensure ordering and durability, enabling scalable fan-out with consumer groups.Final Answer:
Option A -> Option AQuick Check:
Kafka partitions -> durable, scalable decoupling [check]
Solution
Step 1: Understand Kafka's offset commit behavior
Kafka retains messages until consumers commit offsets. If the worker crashes before committing, messages remain available for reprocessing.Step 2: Analyze crash timing
Since the worker crashed before writing summaries and committing offsets, raw events remain in Kafka and will be reprocessed after restart.Final Answer:
Option A -> Option AQuick Check:
Kafka retains uncommitted messages for reprocessing [check]
Solution
Step 1: Evaluate architectures for mobile intermittent connectivity
Pure peer-to-peer (A) suffers from connectivity issues; MCU (C) adds latency and CPU overhead; HLS (D) is high latency and not real-time.Step 2: SFU (B) relays streams selectively, reducing latency and handling network variability well.
Final Answer:
Option C -> Option CQuick Check:
SFU balances latency and reliability for mobile intermittent networks [check]
Solution
Step 1: Identify requirements
Playlists require offline edits and eventual sync with conflict resolution.Step 2: Evaluate architectures
Relational DB (A) blocks offline edits; centralized NoSQL (C) lacks offline sync; local-only (D) risks data loss and complex merges. CRDTs (B) enable conflict-free merges and offline edits.Final Answer:
Option A -> Option AQuick Check:
CRDTs enable offline edits with automatic conflict resolution [check]
Solution
Step 1: Analyze query router bottleneck
Query routers are typically stateless or use connection pooling; they scale horizontally well, so (A) is less likely.Step 2: Evaluate inverted index storage nodes
As index size grows 10x, random disk seeks increase non-linearly, causing latency spikes and throughput degradation, making (B) the primary bottleneck.Step 3: Consider indexing workers and Kafka
Indexing workers and Kafka scale with partitioning and parallelism, so (C) and (D) are secondary bottlenecks.Final Answer:
Option A -> Option AQuick Check:
Disk seek latency grows fastest, limiting index node throughput [check]
