Practice
1. If the API gateway loses the logic to parse the
X-API-Version header, what is the exact failure observed by clients using header-based versioning?medium
Solution
Step 1: Understand gateway header parsing role
The gateway usesX-API-Versionheader to route requests; losing parsing logic means it cannot determine version.Step 2: Trace failure consequences
Without parsing, the gateway may retry or fallback inefficiently, causing increased latency rather than immediate errors or silent fallback.Final Answer:
Option D -> Option DQuick Check:
Missing header parsing causes retries and latency spikes [check]
Hint: Lost header parsing -> gateway retries, causing latency [check]
Common Mistakes:
2. For a leaderboard system requiring global ranking with millions of concurrent updates, which architecture is best to ensure low latency and eventual consistency?
medium
Solution
Step 1: Evaluate single Redis instance
Single Redis can't handle millions of writes with low latency due to CPU and memory limits.Step 2: Consider partitioning by region
Partitioning reduces load per cluster, allows parallel writes, and merging asynchronously balances latency and consistency.Step 3: Distributed SQL and NoSQL drawbacks
Distributed SQL has high write latency; NoSQL batch ranking delays real-time queries.Final Answer:
Option C -> Option CQuick Check:
Partitioned Redis clusters with async merge balance scale and latency [check]
Hint: Partition and merge asynchronously for scale and low latency [check]
Common Mistakes:
3. If the Market Data Feed component crashes and stops publishing updates, what is the exact failure observed by external clients subscribing to real-time stock prices?
medium
Solution
Step 1: Understand Market Data Feed failure impact
When Market Data Feed crashes, it stops pushing updates; clients detect connection loss and receive error events triggering reconnection.Step 2: Eliminate other options
Clients receive stale prices indefinitely with no indication of failure is wrong because clients detect connection loss; Clients receive partial updates but with delayed timestamps causing confusion is wrong because partial updates don't occur without feed; Clients continue receiving cached data from the Matching Engine without updates is wrong because Matching Engine doesn't serve cached market data.Final Answer:
Option C -> Option CQuick Check:
Feed crash -> clients get error + reconnect attempts [check]
Hint: Feed crash triggers client error and reconnect [check]
Common Mistakes:
4. You must design a load balancer for a global web app that requires session stickiness and fault tolerance. Which approach is best?
medium
Solution
Step 1: Identify session stickiness requirement
Session stickiness requires requests from the same client to reach the same server to maintain session state.Step 2: Evaluate options for stickiness and fault tolerance
Round Robin ignores stickiness; Least Connections needs external session store adding complexity; Weighted Round Robin adjusts load but not stickiness. IP Hash provides stickiness by hashing client IP.Final Answer:
Option A -> Option AQuick Check:
IP Hash ensures session stickiness but may cause uneven load distribution [check]
Hint: IP Hash ensures stickiness but risks uneven load distribution [check]
Common Mistakes:
5. For a metrics system that must support both high-frequency real-time alerts and long-term trend analysis, which architecture is best suited?
medium
Solution
Step 1: Analyze pull-only model
Pull-only (A) struggles with high-frequency alerts due to scrape delays and network spikes.Step 2: Analyze push-only and peer-to-peer
Push-only (C) lacks centralized control for trend analysis; peer-to-peer (D) complicates consistency and aggregation.Step 3: Hybrid push-pull benefits
Hybrid (B) buffers metrics for real-time alerts and allows server-side pulls for efficient long-term analysis.Final Answer:
Option A -> Option AQuick Check:
Hybrid push-pull balances real-time and batch needs [check]
Hint: Hybrid push-pull fits real-time and batch analysis best [check]
Common Mistakes:
