Practice
1. For a stock exchange system requiring low-latency order matching and high availability, which architecture is best suited to handle failover without losing in-flight orders?
medium
Solution
Step 1: Analyze architecture requirements
Low latency and high availability require partitioning to avoid bottlenecks and asynchronous replication to avoid blocking on failover.Step 2: Evaluate options
Use a single centralized matching engine with synchronous replication to a hot standby blocks on synchronous replication causing latency; Use multiple independent matching engines with eventual consistency and conflict resolution risks conflicts and inconsistent order books; Use a cloud-managed database with built-in failover and no dedicated matching engine lacks dedicated matching engine causing latency and complexity.Final Answer:
Option A -> Option AQuick Check:
Partitioned matching engine + async replication -> low latency + availability [check]
Hint: Partition and async replication for low latency failover [check]
Common Mistakes:
2. If the metrics aggregation service fails to update the error budget in real time, what is the most likely failure observed by the alerting system?
medium
Solution
Step 1: Understand failure impact on error budget updates
If aggregation service fails partially, inconsistent error counts across nodes cause alerting to behave erratically.Step 2: Eliminate other failure modes
Resetting to zero (A) is unlikely without explicit reset; no alerts (B) implies total failure, not partial inconsistency; delayed alerts (D) imply buffering, not aggregation failure.Final Answer:
Option A -> Option AQuick Check:
Aggregation failure -> inconsistent counts -> random alert triggers [check]
Hint: Aggregation failure causes inconsistent counts, leading to random alerts [OK]
Common Mistakes:
3. At 10x scale, which component is most likely to fail first due to stateful connection limits, and why?
hard
Solution
Step 1: Identify stateful bottleneck
Chat servers maintain WebSocket connections bound to server memory, limiting horizontal scaling and resharding.Step 2: Compare other components
Database (A) can be scaled with sharding; message queue (C) partitions can be increased; load balancer (D) scales horizontally.Step 3: Explain failure mechanism
WebSocket statefulness causes connection limits per server, leading to failure under 10x load.Final Answer:
Option A -> Option AQuick Check:
Stateful WebSocket limits -> chat servers fail first at scale [check]
Hint: Stateful WebSockets limit scaling; stateless scale easier [check]
Common Mistakes:
4. At 10x scale, which component is most likely to become the bottleneck first when handling millions of concurrent video streams and progress updates, and why?
hard
Solution
Step 1: Analyze stateful connection scaling
WebSocket servers maintain stateful connections per user, limiting horizontal scaling due to connection affinity.Step 2: Compare other components' scalability
Relational DB (The relational database storing user progress, due to write contention on user records) can be sharded; CDN (The CDN edge servers, due to bandwidth limits serving video content globally) scales horizontally; Progress Worker (The Progress Worker service, due to single-threaded processing of progress update events) can be parallelized.Final Answer:
Option B -> Option BQuick Check:
WebSocket servers hit stateful connection limits first [check]
Hint: Stateful WebSocket servers limit scaling first [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:
