Practice
Solution
Step 1: Identify the role of Dead Letter Queues
DLQs isolate failed messages from the main queue, enabling retries without blocking normal processing.Step 2: Evaluate alternatives
Relational DBs (A) add latency and complexity; Redis (C) lacks durability guarantees; load balancers (D) do not handle message state or retries.Final Answer:
Option A -> Option AQuick Check:
DLQ isolates failures for retry without blocking main queue [check]
Solution
Step 1: Analyze protocol support requirements
Supporting both REST and gRPC clients in one gateway reduces operational complexity and centralizes transformation logic.Step 2: Evaluate alternatives
Use separate API Gateways for REST and gRPC, each optimized for its protocol increases deployment and maintenance overhead. Use REST-only API Gateway and require gRPC clients to use a proxy converting gRPC to REST adds latency and complexity on client side. Use gRPC-only API Gateway and require REST clients to upgrade to gRPC is impractical as REST clients are widespread.Final Answer:
Option D -> Option DQuick Check:
Single gateway with protocol translation balances support and complexity [check]
Solution
Step 1: Role of distributed consensus in leader election
Consensus protocols ensure exactly one leader at a time, preventing split-brain scenarios.Step 2: Consequences of missing consensus
Without consensus, multiple nodes may act as leader simultaneously, causing conflicting writes and data corruption, breaking availability guarantees.Final Answer:
Option B -> Option BQuick Check:
No consensus -> split-brain -> conflicting writes -> data corruption [check]
Solution
Step 1: Evaluate centralized master node (A)
Centralized master is a single point of failure and bottleneck, reducing availability.Step 2: Evaluate distributed priority queue with leases (B)
Distributed queue with lease-based locks prevents duplicate execution, supports failover, and scales horizontally.Step 3: Evaluate cron jobs (C) and polling without locks (D)
Cron jobs lack coordination causing duplicates; polling without locks risks multiple workers executing the same task.Final Answer:
Option C -> Option CQuick Check:
Distributed queue + leases enable exactly-once and high availability [check]
Solution
Step 1: Analyze component scalability
Databases (The database because it cannot handle the increased write throughput for location updates) can be sharded and scaled horizontally; API gateways (The API gateway because it cannot maintain the increased number of open WebSocket connections) typically scale with load balancers.Step 2: Identify Quadtree bottleneck
Quadtree's recursive traversal is CPU-intensive and stateful, making it hard to parallelize and shard, causing CPU bottlenecks under high query concurrency.Step 3: Evaluate Geohash index load
Geohash buckets (The Geohash prefix index because its fixed-length buckets cause uneven load and hotspotting) can cause hotspots but are easier to shard and cache than Quadtree traversal.Final Answer:
Option A -> Option AQuick Check:
Quadtree traversal CPU bottleneck limits scale first [check]
