Case study demo

Web crawler

Fetch pages from a queue of URLs, wait between hits on one site, and skip pages already seen.

An interactive demo of how this system behaves. It runs in your browser.

Case study · Live model

How a web crawler behaves

A crawler starts from one URL and follows links. The frontier is its list of URLs still to fetch, and the parser pulls the links out of each fetched page. Here there are 60 real pages on 4 sites, plus one site with no end. Turn off the seen filter, politeness or the page limit, and watch what each one was saving you from.

Try it

Lab time 3.0 s
GETsavenew?new URLsURL frontier, 17 URLs waitingURL frontier17 URLs waitingmost so far: 17Fetchers, 2 of 4 busyFetchers2 of 4 busyone site at a timeWeb sites, at most 2 requests eachWeb sitesat most 2 requests eachmost at one site: 1Parser, pulls out the linksParserpulls out the links14 pages readSeen filter, 33 URLs metSeen filter33 URLs metlets only new links passPage store, 14 pagesPage store14 pages0 copies skipped
  • URL frontier — 17 URLs waiting — healthy — most so far: 17
  • Fetchers — 2 of 4 busy — healthy — one site at a time
  • Web sites — at most 2 requests each — healthy — most at one site: 1
  • Parser — pulls out the links — healthy — 14 pages read
  • Seen filter — 33 URLs met — healthy — lets only new links pass
  • Page store — 14 pages — healthy — 0 copies skipped
  • A URL
  • Fetch a page
  • The page
  • Save the page
  • Ask the seen filter
  • The site refused
Real pages found
13/ 60
the crawl is running
Fetched again
0
pages the crawler already had
Refused by sites
0
0 times a site shut the crawler out
Calendar pages
1
the site with no end
Waiting in the frontier
17
2 more being fetched
Most at one site
1
requests at once; a site allows 2

Numbers add up:33 URLs added = 16 taken + 17 waiting + 0 dropped · 16 taken = 14 fetched + 0 refused + 2 being fetched · 14 fetched = 14 stored + 0 copies + 0 fetched againThe lab checks this sum as it runs, so a counting mistake would show here.

Controls

The crawler
4

One request at a site at a time, and 0.5 s between two.

Remember every URL met so far, and let only new links into the frontier.

A budget for each site, so a site with no end cannot keep the crawler for ever.

Site by site

SiteFetchesWaitingMost at onceState
news.example431answering
shop.example431answering
blog.example441answering
docs.example351answering
calendar.example121answering
The frontier, and the real pages found
URLs waitingReal pages found
051015201s2s3s
Show data table
TimeURLs waitingReal pages found
1s21
1s53
2s106
2s119
3s1311
3s1713

What just happened

Nothing yet. Start traffic or run an experiment.

What this model simplifies
  • The web here is 60 pages on 4 sites, plus a calendar site. A real crawl covers billions of pages, and its frontier lives on disk across many machines.
  • A site answers at most 2 requests from the crawler at once, refuses the rest, and shuts the crawler out for 5 s after 3 refusals. Real sites publish their own rules in a robots.txt file.
  • A refused page is not tried again here, so it is missed. A real crawler puts it back in the frontier for later.
  • The seen filter is an exact set. At real size it is a Bloom filter or a table on disk, which trades a few wrong answers for far less memory.
  • The frontier is one line, first in, first out. With politeness on, it passes over a URL whose site is busy. A real frontier also ranks URLs, so that important and fresh pages are fetched first.
  • Page 7 of each site is a printable copy of its page 3. The page store compares the content of each page, and skips one it already holds.
  • The calendar site, calendar.example, stands for every kind of endless site. The limit for each site is 20 pages here; real budgets depend on how good the site is.