LESSON 03 · Robots and politeness

Respect each host

Check crawl preferences and schedule requests at a rate each host can tolerate.

SYSTEM VIEW

The crawl path

Diagram view
Robots—
Blog rate—
Full pass—

Watch a crawler read a small blog’s robots.txt, then pace its requests to that one host while others keep moving.

  1. Before fetching any path on a small blog, the Fetch workers read its robots.txt: a plain text file at the site’s root, standardized in RFC 9309, listing paths that named crawlers are asked to avoid. Robots rules keeps the copy for 24 hours at most.

    Standard
    RFC 9309
    Cache
    24 h at most

    What changed

    • GET /robots.txt
    • Rules cached, 24 h at most
  2. Robots rules checks each path the URL frontier hands out: Disallow: /drafts/ holds /drafts/9, and /posts/7 goes on to the blog. The rules are crawl preferences, not a security boundary or permission to read restricted data. Site terms and law may add constraints.

    Rule
    Disallow: /drafts/
    Not
    a security boundary

    What changed

    • /drafts/9 held by the rule
    • GET /posts/7
  3. When the cached copy reaches 24 hours, the Fetch workers request robots.txt again and the blog answers 503. The RFC says to assume everything is disallowed after a 5xx, so Robots rules holds every path. After a 4xx, the crawler may proceed.

    After a 4xx
    crawl allowed
    After a 5xx
    disallow all

    What changed

    • GET /robots.txt again
    • 503: every path disallowed
  4. The rules load again and work resumes. Most queued URLs belong to the small blog, and the fleet’s only limit is 500 requests at once, so all 500 workers can hit the blog together. A global limit says nothing about how requests spread across hosts.

    Fleet limit
    500 at once
    Per host
    no limit

    What changed

    • Rules loaded again
    • 500 workers on one blog
  5. The Host timer tracks the blog’s next-eligible time and its active requests, and the URL frontier schedules only eligible work. The blog is eligible, so /posts/8 goes out; the timer then holds the blog’s next request for 2 seconds.

    Per host
    1 request / 2 s

    What changed

    • Robots rules off stage, still checked
    • Host timer
    • GET /posts/8
    • Next request in 2 s
  6. Web host A, the blog, answers 429 Too Many Requests, so the Host timer backs off and the blog waits longer between requests. Slow responses, 503 and Retry-After lower a host’s rate the same way. Meanwhile Web host B, another site, keeps getting requests.

    Slows a host
    429, 503, Retry-After

    What changed

    • Web host B
    • Web host A backs off
    • Web host B keeps moving
  7. At one request every 2 seconds, a host allows 43,200 fetches a day, so a site with one million URLs takes about 23 days a pass. Crawl-delay is non-standard, so set your own pace. Group hostnames carefully: separate limits for small sites on one server add up.

    1 request / 2 s
    43,200 a day
    1 million URLs
    about 23 days a pass
    Crawl-delay
    ignored by Google

    What changed

    • 43,200 fetches a day
    • About 23 days per pass

Space plays · ← → step · Home resets

THE IDEA

How it works

Before fetching a path, check the applicable robots.txt rules for the crawler identity. robots.txt is a plain text file at a site’s root, standardized in RFC 9309, listing paths that named crawlers are asked to avoid. Cache the rules and define behavior when they cannot be fetched: the RFC advises against using a cached copy for more than 24 hours, lets a crawler proceed after a 4xx, and tells it to assume everything is disallowed after a 5xx. Robots rules express crawl preferences; they are not a security boundary or permission to access otherwise restricted data. Site terms and applicable law may add constraints.

A global concurrency limit cannot protect a small host from a flood. Track per-host or per-site next-eligible times and active requests, then let the frontier schedule only eligible work. Slow responses, 429, 503, and Retry-After can lower that host’s rate. Keep unrelated hosts moving while one is delayed.

Politeness has a real cost in coverage. At one request every 2 seconds, a host allows 43,200 fetches per day, so a site with one million URLs takes about 23 days per pass. The Crawl-delay directive is non-standard, and Google ignores it, so you still choose your own defaults. Define host grouping carefully: many small sites can share one server, where separate per-hostname limits may still add up to too much.

DECISION POINT

A crawler has 500 workers. Most queued URLs belong to one small site. Why is a global limit of 500 unsafe?

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

Keep in mind

  • Check robots rules before a fetch and refresh cached rules deliberately.
  • Politeness needs per-host scheduling, not only a global worker limit.
CHECK YOUR UNDERSTANDING

Put it into practice.

1 OF 2
RecallQUESTION 01

What does robots.txt primarily communicate?

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.