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: Understand minimal remapping requirement
Modulo-based hashing (Use a simple modulo-based hash function on node count) causes massive remapping when node count changes. Centralized directory (Use a centralized directory service mapping keys to nodes) adds single point of failure and latency. Consistent hashing with virtual nodes (Use consistent hashing with virtual nodes and a hash ring) reduces remapping but is more complex and less direct than Rendezvous Hashing.Step 2: Identify Rendezvous Hashing benefits
Rendezvous Hashing assigns keys to nodes by computing scores and picking the highest, minimizing remapping and avoiding ring maintenance.Final Answer:
Option A -> Option AQuick Check:
Rendezvous Hashing picks highest score node -> minimal remapping [check]
Solution
Step 1: Understand Delivery Worker behavior on subscriber presence TTL expiry
If TTL expired, subscriber is considered offline. Delivery Worker does not retry immediately (The Delivery Worker immediately retries delivery without delay) or mark undeliverable (The Delivery Worker marks the message as undeliverable and stops retries) because retries are needed. It does not refresh TTL (The Delivery Worker queues the message for later retry after refreshing TTL) as TTL is subscriber-driven.Step 2: Recognize fallback to backup subscriber for high availability
Delivery Worker forwards message to backup subscriber or alternative delivery path to ensure eventual delivery.Final Answer:
Option A -> Option AQuick Check:
Expired TTL -> fallback delivery to backup subscriber [check]
Solution
Step 1: Identify stateful bottleneck
Session management holds WebSocket connections statefully, limiting horizontal scaling and resharding.Step 2: Compare other components
Relational DB (A) can be scaled with sharding; cache eviction (B) is manageable with TTL tuning; load balancer (D) scales horizontally.Final Answer:
Option B -> Option BQuick Check:
Stateful WebSocket sessions -> scaling bottleneck at 10x load [check]
Solution
Step 1: Identify stateful bottlenecks at scale
Routing tables maintaining session persistence are stateful and hard to shard, causing scaling limits.Step 2: Compare other components
Health checks scale horizontally; backend servers scale independently; DNS resolvers can be cached and distributed.Final Answer:
Option A -> Option AQuick Check:
Stateful routing tables limit scaling due to session affinity [check]
