← All problems
Dashboard
Courses
Problems
Badges
Theme
Sign inStart free
Problem 012 · Distributed systems

Design a Web Crawler

Medium 50 min

Design a crawler that discovers and downloads web pages for a search engine. It starts from seed URLs, extracts links from each page, and keeps going. It must respect each site's crawl rules, avoid hammering any one host, and skip pages it has already seen.

Functional requirements

  • Fetch pages starting from seed URLs
  • Extract and enqueue new links
  • Skip URLs and content already seen
  • Respect robots.txt and per-host rate limits

Non-functional requirements

  • Crawl 1 000 pages per second sustained
  • A crashed worker loses no URLs
  • No single host receives more than 1 request per second

Constraints and scale

  • 1 billion pages per month
  • Average page 100 KB
  • Millions of distinct hosts

You will practise

  • Use a URL frontier queue with workers
  • Deduplicate with a fast seen-set
  • Isolate slow and failing third parties
Show 2 hints
  1. How do you stop two workers fetching the same URL?
  2. What should happen when a site times out for every request?

Ready to build?

Open the canvas, place your components and explain your decisions. Your draft saves automatically.

Sign in to start

Failure scenarios

  • A huge site starts timing outA site with 50 million URLs in the frontier starts taking 30 seconds per request.

Run them from the workspace once your design is in place.