AI Hints
Home›System Design Tutorial›Case Study: Crawling and Location
System Design · Lesson 106 of 120

Web Crawler at Scale

Polite and parallel.

⏱ 2 min read▶ Video at 2:08:48🎓 Free
Watch this lesson in the System Design courseWatch on YouTube ↗Full System Design course

The real web has billions of pages. A crawler at that scale runs on thousands of machines. And it must be polite, or websites will block it.

Web Crawler at Scale
From the video: Web Crawler at Scale
  • Billions of pages
  • Thousands of machines
  • Must be polite

Crawling problems

Scale brings new problems. Politeness, so we never hammer one site, with a delay between requests to the same host, and respect for robots dot t x t. Duplicates, because many URLs show the same content, so we hash page contents. Traps, like endless calendars, so we limit depth. And freshness, so popular pages are revisited more often.

Politenessdelay per host, robots.txt
Duplicateshash page contents
Trapslimit depth
Freshnessrevisit popular pages

The large-scale design

At scale, the frontier is split by host name, so each host is handled by one worker, which makes politeness easy. The seen set holds billions of URLs, so it's sharded, or uses a compact structure called a Bloom filter. Pages go to object storage, and on to the search indexer.

keyvalue
Frontiersplit by host
One hostone worker, polite
Seen setsharded or Bloom filter
Pagesto storage, then indexing

Summary

A crawler at scale splits work by host to stay polite, removes duplicates, avoids traps, and revisits popular pages. Next, finding things nearby.

Key takeaways
  • Split by host
  • Detect duplicates
  • Avoid traps
Next up: Nearby Search: Geohash — finding close drivers