Practice
1. A high-throughput messaging system must decouple 1 million writes per second from fan-out delivery to thousands of clients. Which component best handles this decoupling to ensure durability and scalability?
easy
Solution
Step 1: Identify the decoupling requirement
Relational DB with row-level locking (Use a relational database with row-level locking to queue messages) cannot handle 1M writes/sec due to locking and durability overhead. Redis (Use Redis as an in-memory queue with TTL for message expiration) lacks durability guarantees and TTL causes message loss risk. Direct synchronous calls (Use direct synchronous HTTP calls from sender to all recipients) block sender and don't scale.Step 2: Evaluate Kafka's suitability
Kafka partitions by conversation ID ensure ordering and durability, enabling scalable fan-out with consumer groups.Final Answer:
Option A -> Option AQuick Check:
Kafka partitions -> durable, scalable decoupling [check]
Hint: Distributed logs decouple writes and fan-out reliably [check]
Common Mistakes:
2. A web crawler must efficiently avoid re-crawling the same URLs too frequently while ensuring freshness. Which component best handles URL scheduling and politeness constraints?
easy
Solution
Step 1: Identify URL scheduling role
The URL Frontier manages which URLs to crawl next, enforcing politeness and freshness constraints.Step 2: Evaluate other components
PageRank ranks pages post-crawl, not for scheduling. Distributed KV stores hold content but don't schedule. Random distribution ignores politeness.Final Answer:
Option A -> Option AQuick Check:
URL Frontier enforces crawl politeness and freshness [check]
Hint: URL Frontier schedules URLs with politeness [check]
Common Mistakes:
3. In the DNS resolution chain, at step 4 the recursive DNS server receives a referral response from the root server pointing to a TLD server. What state does the recursive server enter immediately after receiving this referral?
easy
Solution
Step 1: Understand recursive server behavior on referral
When the recursive DNS server receives a referral from the root server, it caches the referral information (the TLD server's IP) and then queries the TLD server itself.Step 2: Eliminate incorrect states
It does not cache the root server IP (already known), nor does it discard the referral or forward it directly to the client. The recursive server handles the full resolution chain transparently.Final Answer:
Option A -> Option AQuick Check:
Recursive server caches referral and queries next server [check]
Hint: Recursive server caches referrals and queries next hop [check]
Common Mistakes:
4. For a search system with highly skewed term distributions and frequent query updates, which scoring approach is better and why?
medium
Solution
Step 1: Analyze term distribution and query update needs
Skewed term distributions cause TF-IDF to overweight rare terms excessively; frequent updates require robust scoring.Step 2: Evaluate scoring methods
BM25 accounts for term frequency saturation and normalizes by document length, improving relevance in skewed data; TF-IDF and raw TF lack these refinements; vector space ignoring TF loses relevance signals.Final Answer:
Option C -> Option CQuick Check:
BM25 handles skew and length normalization better than TF-IDF [check]
Hint: BM25 normalizes length and term saturation better than TF-IDF [check]
Common Mistakes:
5. At 10x scale, which component in an object storage system is most likely to fail first and why?
hard
Solution
Step 1: Identify scaling bottlenecks in object storage
Object storage separates data and metadata; metadata/index service manages global namespace and object lookup.Step 2: Analyze impact of 10x scale
Metadata service faces massive concurrent requests and metadata updates, becoming a centralized bottleneck before data nodes or storage devices.Final Answer:
Option B -> Option BQuick Check:
Metadata service bottlenecks first at massive scale [check]
Hint: Metadata service bottlenecks first at massive object scale [check]
Common Mistakes:
