Practice
1. For storing user and item embeddings in a recommendation system, which storage choice best balances low-latency reads and frequent updates at scale?
medium
Solution
Step 1: Identify storage requirements
Embedding storage requires low-latency reads and frequent writes at scale with high availability.Step 2: Evaluate storage options
Relational DB (A) struggles with write throughput and scaling; Cassandra (B) offers tunable consistency but may add complexity; file system batch loading (D) introduces stale data and high latency. Document store (C) supports flexible schema and fast reads with embedded documents, balancing latency and update frequency.Final Answer:
Option A -> Option AQuick Check:
Document store balances flexible schema and read/write latency [check]
Hint: Document store balances schema flexibility and latency [check]
Common Mistakes:
2. If the machine ID component is misconfigured and two machines generate Snowflake IDs with the same machine ID simultaneously, what is the most likely failure mode?
medium
Solution
Step 1: Understand machine ID role in uniqueness
Machine ID differentiates ID generators on different machines; same machine ID risks collisions.Step 2: Analyze collision handling
Different timestamps alone (A) do not guarantee uniqueness if clocks are synchronized; sequence number does not auto-adjust across machines (C is incorrect). System does not detect conflicts automatically (D).Step 3: Correct failure mode
Duplicate IDs are generated if machine IDs collide, causing data corruption or overwrite.Final Answer:
Option A -> Option AQuick Check:
Same machine ID + same timestamp -> duplicate IDs and data corruption [check]
Hint: Same machine ID causes duplicate IDs, no auto correction [OK]
Common Mistakes:
3. Without a centralized coordination service (like ZooKeeper) in a horizontally scaled cluster, what exact failure occurs during leader election?
medium
Solution
Step 1: Understand role of centralized coordination in leader election
Coordination service ensures single leader election and consensus.Step 2: Analyze failure without coordination
Without it, leader election retries occur causing latency but eventual leader election succeeds via timeouts.Final Answer:
Option C -> Option CQuick Check:
Leader election delays but does not halt cluster without coordination [check]
Hint: No coordination causes leader election delays, not total failure [check]
Common Mistakes:
4. At 10x scale, which component in a distributed tracing system is most likely to become the bottleneck first, and why?
hard
Solution
Step 1: Analyze component scaling challenges
Centralized Trace Storage must index and store exponentially more spans at 10x scale, stressing storage I/O and query performance.Step 2: Evaluate other components
Trace Collector is often horizontally scalable and asynchronous, reducing CPU bottleneck risk. Instrumentation overhead is minimal per request. Trace headers increase size but not enough to cause packet loss at scale.Final Answer:
Option B -> Option BQuick Check:
Storage I/O overwhelmed first at 10x scale [check]
Hint: Storage I/O chokes first at massive trace volume scale [OK]
Common Mistakes:
5. At 10x scale, which component in an async messaging chat system fails first and why?
hard
Solution
Step 1: Analyze stateful components and scaling challenges
Databases (The database, because increased writes cause lock contention) can be scaled with sharding and replicas. Message queue brokers (The message queue brokers, due to partition leader overload) scale horizontally with partitions. Delivery workers (The delivery workers, because retry queues grow exponentially) can be scaled with backpressure.Step 2: Identify chat servers as stateful WebSocket connection holders
Chat servers maintain persistent WebSocket connections bound to server memory, making resharding or migration difficult at scale.Final Answer:
Option C -> Option CQuick Check:
Stateful WebSocket servers -> first bottleneck at 10x scale [check]
Hint: Stateful WebSocket servers limit horizontal scaling first [check]
Common Mistakes:
