Backend system design · about 45 minutes
Web crawler
Design a crawler that downloads the pages of the public web for a search engine. It starts from a list of seed URLs, follows the links that it finds, and stores each page for the indexer. The crawler must not overload a site, and it must fetch a page again after the page changes.
Ask first
- How many pages do we fetch each month, and how large is a page on average?
- Do we fetch only HTML, or also images, PDF files and pages that need JavaScript?
- How fresh must a page be? Does a news page need a new fetch each hour?
- Which politeness rules apply: robots.txt, and how many requests to one host each second?
- What does the next system need: the raw pages, the text, or the link graph also?
The outline
Write your own outline for each part first.
The strong answer, the pitfalls and the follow-ups opens with a year in the app. What a year includes