KatInterview

Build a Large-Scale Web Crawler Architecture

System DesignModel answer
MediumModel answerSystem Designdistributed-systemsscalabilitycrawling

Last updated

Design a distributed crawler that fetches and processes billions of web pages weekly while respecting rate limits and avoiding duplicate work.

Problem

You need to architect a web crawling platform that continuously discovers and downloads pages from the public internet. The system must handle billions of URLs, keeping content reasonably current without overwhelming servers or wasting resources on redundant downloads.

What the system must do

  1. Find new URLs: Extract links from crawled pages to discover more content
  2. Download respectfully: Fetch pages while honoring robots.txt directives and avoiding request floods to any single server
  3. Avoid redundancy: Skip URLs and content you've already processed
  4. Prepare for search: Output cleaned documents ready for a search indexing pipeline

Scale targets

  • Corpus size: 10 billion pages
  • Refresh cycle: Complete recrawl within one week
  • Throughput: Sustain roughly 15,000-20,000 pages per second on average
  • Freshness: Prioritize frequently-changing content over static pages

What to provide

  1. Architecture overview: Describe the major components and how data flows between them
  2. Storage approach: Explain how you track which URLs have been seen and manage the crawl queue at this scale
  3. Capacity estimates: Calculate storage needs and server counts to meet throughput goals
  4. Design decisions: Discuss trade-offs between complexity, cost, and how current the data stays

Hints

Hint 1

Start by calculating the required pages-per-second rate and estimating typical page sizes to understand bandwidth and storage needs

Hint 2

The URL queue needs two separate concerns: choosing what to crawl next (priority) versus respecting per-host rate limits (politeness)

Hint 3

Use probabilistic data structures like Bloom filters for fast duplicate detection, backed by authoritative storage for accuracy