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
How do you stop two workers fetching the same URL?
What should happen when a site times out for every request?