Design a Web Crawler at Google Scale
Quick Overview
Design a web crawler that indexes billions of pages. Cover URL frontier and prioritization, politeness policies, distributed crawling coordination, content deduplication, and incremental re-crawling strategies.
0
Design a web crawler that indexes billions of pages. Cover URL frontier and prioritization, politeness policies, distributed crawling coordination, content deduplication, and incremental re-crawling strategies.
Crawler design is a hard Google onsite question because it sits at the start of the search pipeline, and every choice affects freshness, coverage and how fairly other sites' servers are treated. The interviewer checks URL frontier design, per-host politeness, deduplication and a re-crawl policy that tracks how often pages change.
What the Interviewer Expects
- Estimate scale: pages per day, fetch bandwidth, storage for content and URL state
- Design a URL frontier with priority queues plus per-host politeness queues
- Respect robots.txt and per-domain rate limits, with DNS caching
- Deduplicate URLs (normalization, Bloom filter) and content (checksums, SimHash)
- Partition crawl work by host hash across workers and handle worker failure
- Schedule re-crawls by observed change rate and page importance
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you avoid crawler traps such as infinite calendar pages?
- How would you crawl JavaScript-heavy pages that render content client side?
- How do you detect near-duplicate pages at billions-scale?
- How do you rebalance work when a few hosts hold a huge share of URLs?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional Requirements
- Web Page Fetching: The crawler must be able to fetch HTML content from billions of URLs.
- URL Frontier Management: Maintain a prioritized list of URLs to crawl...
Capacity Estimation
Assuming we need to crawl and index 1 billion pages:
- Crawl Rate: If we crawl 100,000 pages per minute, it would take approximately 10,000 minutes (~7 days) to initially crawl the entire web.
- *...