System design
Design a web crawler
Design a web crawler that feeds a search index. Starting from a list of seed URLs, it downloads each page, pulls out its links, and adds the new ones to the list to crawl.
It should fetch 1 billion pages a month, about 400 a second, averaging 100 KB a page. It must follow each site’s robots.txt, send any one site no more than one request a second, skip pages it already has, and revisit pages that change often more often than ones that don’t.
Things to cover
- The URL frontier: what to fetch, and in what order
- Politeness: robots.txt and a rate limit per site
- Spotting duplicate URLs and duplicate content
- Spreading the work across machines, and crawler traps