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.
A crawler has 500 workers. Most queued URLs belong to one small site. Why is a global limit of 500 unsafe?
All 500 workers could hit the same site. Limit concurrent and timed requests for that host while scheduling other hosts independently.
Use this as a guide for self review; written answers are not graded.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.