Practice
Solution
Step 1: Trace key assignment in consistent hashing
Consistent hashing assigns keys to the first node clockwise from the key's hash on the ring.Step 2: Eliminate incorrect options
Lower hash value assignment breaks ring semantics; rehashing or broadcasting is inefficient and not part of consistent hashing.Final Answer:
Option A -> Option AQuick Check:
Consistent hashing assigns keys clockwise on the ring [check]
Solution
Step 1: Understand hash function independence role
Independent hash functions distribute bits uniformly; correlated hashes cause clustering.Step 2: Trace effect of correlated hashes
Correlated hashes set overlapping bits, saturating the bit array faster, increasing false positives and reducing filter effectiveness.Final Answer:
Option A -> Option AQuick Check:
Correlated hashes cause bit array saturation, raising false positives [check]
Solution
Step 1: Trace failure impact of message queue outage
The queue decouples upload and transcoding. Without it, upload service cannot enqueue transcoding jobs. Uploads succeed but transcoding workers receive no tasks, so no processed videos are generated. Blocking upload (B) is incorrect because upload is asynchronous. Duplicate transcoding (A) is unrelated. View count errors (D) happen downstream, not due to queue failure.Step 2: Confirm exact failure mode
Uploads accepted but stuck before transcoding is the precise failure.Final Answer:
Option A -> Option AQuick Check:
Queue failure causes transcoding jobs to be lost, no processed videos [check]
Solution
Step 1: Evaluate centralized generator with sync replication
This causes high latency and single point of failure, unsuitable for geo-distributed low-latency needs.Step 2: Assess decentralized Snowflake approach
Decentralized generators with node IDs and loosely synchronized clocks provide low latency and uniqueness with approximate ordering.Step 3: Consider UUID v4 and DB auto-increment
UUID v4 lacks ordering; DB auto-increment with partitioning risks collisions and coordination overhead.Final Answer:
Option B -> Option BQuick Check:
Decentralized Snowflake -> low latency + uniqueness + approximate ordering [check]
Solution
Step 1: Analyze scaling challenges
Matching Engine partitions order books per stock symbol, but large cross-symbol or large orders require coordination, causing latency and bottlenecks at scale.Step 2: Evaluate other components
Market Data Feed scales with multicast or sharding; Order Book storage uses scalable Kafka or NoSQL; network layer scales with load balancers and horizontal scaling.Final Answer:
Option D -> Option DQuick Check:
Cross-partition coordination -> Matching Engine bottleneck at scale [check]
