Practice
Solution
Step 1: Understand key distribution and remapping
Modulo-based hashing (A simple modulo-based hash function assigning keys to servers by key % server_count) causes massive remapping when server count changes, violating minimal reshuffling.Step 2: Evaluate consistent hashing with virtual nodes
Consistent hashing with virtual nodes (A consistent hashing ring with virtual nodes to balance load and reduce remapping) evenly distributes keys and minimizes remapping on node changes.Final Answer:
Option C -> Option CQuick Check:
Virtual nodes in consistent hashing minimize key remapping on node changes [check]
Solution
Step 1: Understand Delivery Worker behavior at Step 4
It checks message TTL to decide if delivery attempts should continue.Step 2: TTL expiration handling
Expired messages are discarded without retry or marking to avoid resource waste; indefinite retries (A) cause resource exhaustion; marking expired (B) is not standard; dead-letter queue (C) is for failed, not expired messages.Final Answer:
Option B -> Option BQuick Check:
Expired messages are discarded to maintain throughput and latency balance [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: Identify stateful bottlenecks at scale
The Idempotency Store holds global state and is hard to shard, limiting horizontal scaling.Step 2: Evaluate other components
Settlement Service can be scaled with partitioned batches; client SDK is client-side and less critical; load balancer scales horizontally with modern tech.Final Answer:
Option B -> Option BQuick Check:
Centralized idempotency store -> scaling bottleneck at 10x load [check]
Solution
Step 1: Identify stateful components in WebSocket architecture
WebSocket connections are stateful and maintained in server memory, binding clients to specific chat servers.Step 2: Analyze scaling challenges
At 10x scale, chat servers face difficulty resharding connections or migrating them, limiting horizontal scaling. Databases and load balancers can be scaled more easily. Client browser limits are less impactful at system scale.Final Answer:
Option A -> Option AQuick Check:
WebSocket stateful connections -> chat servers bottleneck at scale [check]
