Practice
Solution
Step 1: Identify location query requirements
Real-time matching requires low-latency spatial queries on dynamic driver locations.Step 2: Evaluate component suitability
Relational DBs (A) have high latency for frequent updates; Kafka (C) streams data but doesn't index locations; Hadoop (D) is batch-oriented and too slow. In-memory spatial indexes (B) provide fast nearest-neighbor queries and frequent updates.Final Answer:
Option A -> Option AQuick Check:
In-memory spatial index enables fast real-time location queries [check]
Solution
Step 1: Trace cache invalidation at step 4
Cache invalidation is asynchronous and best-effort; failure does not rollback DB writes.Step 2: Understand failure impact on cache state
If invalidation fails, Redis cache remains stale until TTL expiry or next explicit refresh.Final Answer:
Option C -> Option CQuick Check:
Failed cache invalidation -> stale cache until TTL or manual refresh [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: Analyze bottlenecks at 10x query scale
Shard nodes perform CPU-intensive inverted index lookups; query volume increase causes CPU saturation first.Step 2: Compare other components
Query Coordinator merges are parallelizable; cache evictions increase but cache can be scaled; indexing pipeline is async and can be scaled horizontally.Final Answer:
Option D -> Option DQuick Check:
Shard nodes CPU-bound -> first failure point at scale [check]
Solution
Step 1: Identify storage node bottlenecks at high write volume
Disk I/O can saturate under 10x writes, limiting storage node throughput.Step 2: Compare other components' scalability
Session management can shard state; load balancers and network switches scale with hardware upgrades.Final Answer:
Option C -> Option CQuick Check:
Disk I/O saturation -> storage node bottleneck at 10x scale [check]
