Design a Web Crawler
Design a crawler that fetches web pages for a search engine: 1B pages per month, re-crawling important pages often, without overloading any website and without fetching duplicates.
How the interview goes
Five phases, and questions the interviewer is likely to ask in each.
1. Requirements
- How often should a news site be re-crawled versus a static page?
- What does 'polite' mean concretely?
Show a hintHint
Turn 1B pages per month into pages per second.
2. High-level design
- How do newly discovered links flow back into the system?
- Where are pages stored?
Show a hintHint
The crawler is a loop: fetch, parse, enqueue.
3. Deep dive
- How do you enforce one request per second per host across 100 fetchers?
- How do you detect near-duplicate content?
Show a hintHint
Group URLs by host so a host is only fetched by one worker at a time.
4. Scaling
- How do you partition the frontier?
- What breaks first at 10x?
Show a hintHint
Billions of 'seen' checks need a compact structure.
5. Trade-offs
- Exact versus probabilistic duplicate detection?
- Breadth-first versus priority-based crawling?
Show a hintHint
A small false-positive rate may be acceptable for 'seen' checks.
Practice this with an AI interviewer
Write your design doc with live diagrams while the interviewer asks one question at a time and pushes on your choices. Get a scored debrief with what to study next.
Start this interview