Practice
Solution
Step 1: Identify query pattern
Range queries on signup dates require data locality by date ranges to avoid scatter-gather queries.Step 2: Match sharding strategy
Range-based sharding partitions data by contiguous key ranges, enabling efficient range scans.Final Answer:
Option C -> Option CQuick Check:
Range sharding groups data by key intervals for range queries [check]
Solution
Step 1: Trace Delivery Worker decision at Step 4 -- follower cache TTL expired
If the cache is expired, the Delivery Worker must fetch fresh data to ensure the follower receives the latest feed snapshot.Step 2: Evaluate other options
Skipping (A) causes missed updates; retrying without cache update (C) delays delivery; sending stale data (D) violates freshness guarantees.Final Answer:
Option A -> Option AQuick Check:
Expired cache triggers DB fetch for fresh feed [check]
Solution
Step 1: Trace Log Processor behavior at Step 4
It reads logs from Kafka and enriches them before forwarding.Step 2: Understand failure handling
If enrichment service is down, buffering and retrying prevents data loss and ensures enrichment.Final Answer:
Option A -> Option AQuick Check:
Buffer and retry enrichment -> no data loss or offset commit [check]
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: Identify stateful bottleneck
Chat servers maintain WebSocket connections statefully, limiting horizontal scaling.Step 2: Understand scaling impact
At 10x scale, existing WebSocket connections cannot be moved, causing chat servers to saturate first.Final Answer:
Option C -> Option CQuick Check:
Stateful WebSocket servers bottleneck scaling before DB or load balancer [check]
