Design a Web Crawler
Quick Overview
Design a large-scale web crawler that can index billions of pages. Cover URL frontier management, politeness policies, deduplication, content extraction, and distributed crawling coordination.
Meta
0
Design a large-scale web crawler that can index billions of pages. Cover URL frontier management, politeness policies, deduplication, content extraction, and distributed crawling coordination.
This appears in Meta's system design onsite and connects to work like link previews, content integrity checks, and indexing external pages shared on its apps. The interviewer checks URL frontier design, politeness, deduplication, and how you coordinate many crawler nodes reliably.
What the Interviewer Expects
- Design a URL frontier that balances priority and per-host politeness
- Respect robots.txt and rate limit requests per domain
- Deduplicate both URLs and near-duplicate content
- Partition crawl work across nodes, for example by host hash
- Estimate throughput, storage, and bandwidth for billions of pages
- Handle failures, traps, and recrawl scheduling
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 detect and avoid crawler traps like infinite calendars?
- How do you decide how often to recrawl a page?
- How would you detect near-duplicate pages efficiently?
- How do you rebalance work when crawler nodes join or fail?
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
- URL Frontier Management: Maintain a priority queue of URLs to be crawled, ensuring efficient fetching of new content.
- Politeness Policies: Implement rules to ...
Capacity Estimation
Assuming we aim to crawl 1 billion pages:
- Fetch Rate: If each crawler can fetch 10 pages per second and we have 100 concurrent crawlers, the total fetch rate is 1,000 pages/second.
- **Crawl Tim...