Practice
Solution
Step 1: Understand shard assignment requirements
Modulo hashing (Use a modulo-based hash function on the primary key to assign shards directly) causes massive remapping when shards change; centralized lookup (Assign shards based on a centralized lookup table updated on every shard change) creates a bottleneck and single point of failure; range partitioning (Use range-based partitioning with fixed key ranges per shard) can cause hotspots and uneven load.Step 2: Evaluate consistent hashing benefits
Consistent hashing with virtual nodes (Implement consistent hashing with virtual nodes to map keys to shards) evenly distributes keys and minimizes remapping when shards are added or removed, making it ideal for dynamic shard management.Final Answer:
Option B -> Option BQuick Check:
Consistent hashing minimizes shard remapping on topology changes [check]
Solution
Step 1: Understand forward proxy header modification
At step 3, the forward proxy removes headers that reveal client identity and inserts its own IP as the source to hide the client.Step 2: Eliminate other options
It does not replace destination IP (that would break routing), nor encrypt payload (that's TLS), nor cache response before request forwarding.Final Answer:
Option A -> Option AQuick Check:
Forward proxy masks client IP by header modification [check]
Solution
Step 1: Evaluate persistent connection approaches
gRPC streaming (A) is unreliable on mobile due to network changes and battery constraints; long polling (C) wastes battery and bandwidth.Step 2: Consider platform push services and SMS
Push services (B) handle retries and offline buffering efficiently; SMS (D) is costly and not suitable for all notifications.Final Answer:
Option A -> Option AQuick Check:
Platform push services manage retries and offline buffering [check]
Solution
Step 1: Analyze architecture trade-offs
Synchronous two-phase commit (Use a synchronous two-phase commit protocol across all services to guarantee atomicity) blocks and reduces throughput; centralized DB (Use a centralized relational database with serializable transactions for all payment states) limits scalability; client-side retries (Use client-side retries with unique request IDs and eventual consistency in backend) risk inconsistent states.Step 2: Evaluate event-driven approach
Kafka event sourcing with idempotent consumers supports high throughput, fault tolerance, and exactly-once processing semantics.Final Answer:
Option A -> Option AQuick Check:
Kafka event sourcing -> scalable, fault-tolerant, idempotent processing [check]
Solution
Step 1: Understand PageRank failure impact
Without updated PageRank, the system cannot assign fresh relevance scores, causing degraded or random ordering.Step 2: Evaluate other impacts
Search remains available (not A). Last snapshot is not used if update fails mid-cycle (not B). Indexing continues independently (not D).Final Answer:
Option B -> Option BQuick Check:
PageRank failure causes degraded ranking, not outage [check]
