LESSON 02 · Discovery loop

Trace one page through the system

Turn a seed URL into a document, then feed discovered links back into the frontier.

SYSTEM VIEW

The crawl path

Diagram view
Links found—
New URLs—
Lease—

Follow one page from a leased URL to a stored document and 15 new URLs, then crash the worker before the lease completes.

  1. Seed URLs wait in the URL frontier, the durable list of URLs to fetch. The Fetch worker leases example.org/guide: it claims the URL for a limited time, here an example lease of 5 minutes.

    What changed

    • example.org/guide leased
    • Lease runs 5 minutes
  2. Before it fetches, the Fetch worker checks crawl policy and resolves the host. It fetches example.org/guide with bounds, gets a 200 response of 180 KB from the Web host, and records the outcome.

    What changed

    • GET /guide
    • 200 · 180 KB recorded
  3. The Fetch worker hands the 180 KB of HTML to the Parser. The Parser validates the response, extracts the document’s information and finds 40 links on the page.

    What changed

    • 180 KB handed to the Parser
    • 40 links found
  4. The Link filter drops 25 of the 40 links as already seen or out of scope, and 15 become new entries in the URL frontier. That closes the discovery loop: each page can create more work, so a crawl needs a budget rather than a natural end.

    Found
    40
    Dropped
    25
    New
    15

    What changed

    • 25 dropped: seen or out of scope
    • 15 new frontier entries
  5. The Parser hands the document to the Page store, the sink: storing is a separate stage from parsing. Only then is the lease on example.org/guide marked complete.

    What changed

    • Document in the Page store
    • Lease complete
  6. Suppose instead the Fetch worker crashes after the page is stored and its links queued, but before the lease is complete. The URL isn’t silently lost: after 5 minutes the lease expires, and example.org/guide is eligible again.

    What changed

    • Fetch worker crashes before completing
    • Lease expires after 5 minutes
    • example.org/guide eligible again
  7. Another worker leases the URL, then fetches and processes the page again. The document lands under the same key, so the Page store keeps one copy, and the 15 links are already queued. This is at-least-once processing: simpler than exactly once, at the cost of occasional repeats.

    What changed

    • Another worker
    • Same key: one stored copy
    • 15 links already queued
    • Lease complete

Space plays · ← → step · Home resets

THE IDEA

How it works

Seed URLs enter a durable frontier, the stored list of URLs waiting to be fetched. A worker leases an eligible URL, meaning it claims the URL for a limited time, then checks crawl policy, resolves the host, fetches the response with bounds, and records the outcome. A parser validates the response, extracts document information and links, and hands accepted content to storage or an index pipeline. Links that pass filtering and deduplication return to the frontier.

Trace one page, with example values. A worker leases example.org/guide with a 5-minute lease and gets a 200 response of 180 KB. The parser finds 40 links. A filter drops 25 as already seen or out of scope, so 15 become new frontier entries, and the document goes to the sink. Only then is the lease marked complete. Each fetched page can create more work, which is why a crawl needs a budget rather than waiting for a natural end.

Keep each stage observable and independently recoverable. A worker crash after fetching should not silently lose a URL; a lease can expire and make it eligible again. That means downstream writes and link insertion need idempotent keys or deduplication, because the same page may be processed twice. This is at-least-once processing: simpler than guaranteeing exactly one fetch, at the cost of occasional repeats. A successfully fetched page can still fail parsing, and a parsed page can still be excluded from indexing.

DECISION POINT

A worker crashes after downloading a page but before acknowledging its frontier item. What should happen?

Write a sentence or two to unlock the guidance. Committing first is what makes it stick.

Keep in mind

  • The frontier closes the discovery loop; parsing and storage are distinct stages.
  • Leases and idempotent processing make worker failure recoverable.
CHECK YOUR UNDERSTANDING

Put it into practice.

1 OF 2
RecallQUESTION 01

What closes the crawler discovery loop?

Choose an answer. You’ll see the explanation once you get it right.

Next lesson

0 of 2 checkpoints answered correctly to complete this lesson.