Practice
1. For managing user playlists with frequent updates and offline sync, which storage architecture is best suited given the need for eventual consistency and offline support?
medium
Solution
Step 1: Identify requirements
Playlists require offline edits and eventual sync with conflict resolution.Step 2: Evaluate architectures
Relational DB (A) blocks offline edits; centralized NoSQL (C) lacks offline sync; local-only (D) risks data loss and complex merges. CRDTs (B) enable conflict-free merges and offline edits.Final Answer:
Option A -> Option AQuick Check:
CRDTs enable offline edits with automatic conflict resolution [check]
Hint: CRDTs handle offline sync and conflicts automatically [check]
Common Mistakes:
2. During a global network outage caused by BGP misconfiguration, which recovery approach balances speed and safety best for restoring connectivity without causing routing loops?
medium
Solution
Step 1: Understand recovery trade-offs
Immediate re-advertisement (A) risks routing loops and instability; static routes (C) don't scale globally; client retries (D) don't fix routing issues.Step 2: Evaluate gradual reintroduction
Route flap damping (B) prevents rapid route changes causing instability, balancing speed and safety during recovery.Final Answer:
Option A -> Option AQuick Check:
Route flap damping prevents loops during gradual route restoration [check]
Hint: Gradual route reintroduction with damping avoids loops [check]
Common Mistakes:
3. If the WebSocket server crashes unexpectedly, what is the immediate failure mode experienced by connected clients?
medium
Solution
Step 1: Understand WebSocket failure behavior
When the WebSocket server crashes, the TCP connection closes, and clients receive a close event.Step 2: Trace message delivery impact
Messages sent during downtime are lost unless the application implements retries. Clients must reconnect manually or via client logic. There is no automatic buffering or fallback to Long Polling.Final Answer:
Option C -> Option CQuick Check:
WebSocket crash -> connection close event, no automatic buffering [check]
Hint: WebSocket crash -> clients disconnect, no auto-retry [check]
Common Mistakes:
4. At 10x scale, which component in your design explanation is most likely to fail first due to stateful connection bottlenecks, and why?
hard
Solution
Step 1: Identify stateful components at scale
WebSocket servers maintain persistent connections bound to server memory, limiting horizontal scaling.Step 2: Compare with stateless components
Stateless API servers and load balancers scale horizontally more easily; databases fail later due to storage.Final Answer:
Option A -> Option AQuick Check:
Stateful WebSocket servers bottleneck first due to connection affinity [check]
Hint: Stateful WebSocket servers bottleneck first at scale [check]
Common Mistakes:
5. At 10x scale, which component in a relational database system is most likely to fail first and why?
hard
Solution
Step 1: Identify scaling bottlenecks
At 10x scale, contention on locks and transaction coordination overhead increase dramatically.Step 2: Why transaction coordinator fails first
Locking and coordination cause blocking and deadlocks, limiting throughput before storage or connection limits.Final Answer:
Option C -> Option CQuick Check:
Transaction coordinator bottlenecks due to lock contention at scale [check]
Hint: Lock contention chokes transaction coordinator first at scale [check]
Common Mistakes:
