Practice
Solution
Step 1: Evaluate single Redis instance
Single Redis can't handle millions of writes with low latency due to CPU and memory limits.Step 2: Consider partitioning by region
Partitioning reduces load per cluster, allows parallel writes, and merging asynchronously balances latency and consistency.Step 3: Distributed SQL and NoSQL drawbacks
Distributed SQL has high write latency; NoSQL batch ranking delays real-time queries.Final Answer:
Option C -> Option CQuick Check:
Partitioned Redis clusters with async merge balance scale and latency [check]
Solution
Step 1: Understand Kafka's role as event buffer
Kafka decouples score submission from ranking processing, enabling asynchronous updates.Step 2: Trace failure without Kafka
Without Kafka, updates are synchronous; buffering is lost, so ranking workers see stale data until writes complete.Step 3: Eliminate other options
Redis persists data; frontend blocking is unlikely if designed asynchronously; duplicates come from retries, not Kafka removal.Final Answer:
Option B -> Option BQuick Check:
Without Kafka buffering, leaderboard updates lag causing stale data [check]
Solution
Step 1: Evaluate persistent connection options
gRPC streaming is efficient but less supported on mobile platforms and can drain battery.Step 2: Compare WebSocket and polling
WebSocket supports bidirectional communication with reconnection and heartbeats, balancing real-time and battery use better than polling.Final Answer:
Option A -> Option AQuick Check:
WebSocket balances real-time updates and mobile constraints [check]
Solution
Step 1: Identify component handling content negotiation
The API gateway parsesAcceptheaders to route requests to correct versioned backend.Step 2: Analyze scaling impact
Parsing headers is CPU-intensive and cannot leverage caching well, causing gateway CPU to saturate first at high request volumes.Step 3: Compare other components
Backends scale horizontally; CDNs struggle but can be configured; client SDKs are not server bottlenecks.Final Answer:
Option B -> Option BQuick Check:
Gateway CPU parsing Accept headers saturates first at scale [check]
Solution
Step 1: Identify stateful bottlenecks
Chat servers maintain WebSocket connections statefully, binding clients to specific servers.Step 2: Scaling challenges
At 10x scale, adding servers doesn't move existing connections, causing uneven load and resource exhaustion.Step 3: Why others fail later
Databases can be sharded (The database because it cannot handle increased write throughput without sharding), load balancers scale horizontally (The load balancer because it cannot distribute connections evenly at high scale), and CDNs handle scale well (The CDN because cache invalidation delays increase latency).Final Answer:
Option A -> Option AQuick Check:
Stateful WebSocket servers -> resharding limits cause first failure [check]
