Web Crawler
A crawler is a scheduler with a fetch-and-discover loop.
Clarify this prompt before choosing components
Ask the highest-impact questions first, agree on priorities, and record the interviewer’s answers. If a detail is unspecified, state an assumption and explain which decision depends on it. The numbers in this worked lesson are exercise assumptions, not company facts.
| Ask the interviewer | Why the answer changes the design |
|---|---|
| Whole web, a domain list or authenticated sites? | Scope defines discovery and access constraints. |
| Freshness, politeness and robots policy? | Per-host budgets and revisit scheduling dominate throughput. |
| What counts as the same URL/content, including redirects? | Canonicalization and content identity determine duplicate suppression. |
Use the Interview Playbook for the shared 45-minute sequence and fresher, intermediate, senior and staff evidence. Start with one complete operation. Extend the answer with the failure/recovery traces below, then defend a workload-specific alternative and a measurable rollout. Scope and evidence matter more than a large component list.
Web Crawler: Understand the building blocks
Choose a mechanism because it satisfies a requirement. These explanations describe the exercise design, not undisclosed implementation choices at the named company.
Web Crawler: Quick vocabulary
| Term | Meaning and role in this exercise |
|---|---|
| API: Application Programming Interface | The contract for requests, responses and errors between components. An API route does not itself enforce every business invariant. |
| HTTP: Hypertext Transfer Protocol | The request/response protocol used by web APIs and media fetching. Application retries still need safe operation identities. |
| DNS: Domain Name System | Resolves names to network addresses. An untrusted fetch policy must also validate resolved targets and redirects. |
| TLS: Transport Layer Security | Protects a network connection’s confidentiality/integrity and peer authentication under its configuration; it is distinct from endpoint-only message encryption. |
| URL: Uniform Resource Locator | Names a resource and access location. Normalize carefully and do not trust an imported address as a safe server fetch destination. |
| PK: Primary Key | The declared row identity in a database schema; it does not automatically enforce every cross-row business rule. |
Web Crawler: Durable work queue and backpressure
What it means: A queue separates accepted work from execution. Backpressure limits admission or consumption when downstream capacity is finite.
Why this problem needs it: A frontier stores accepted URLs for bounded future fetches.
How to use it: Persist a stable job identity, consume with bounded concurrency, acknowledge after the required durable transition, and cap retries/backlog according to policy.
Example in this design: Accept seen-state plus durable frontier identity under a protocol that cannot silently lose the job.
When it fits: Useful for asynchronous work that must survive worker failure or absorb a finite burst.
Alternative and limits: A synchronous call is simpler for short bounded work. A queue does not create capacity, strict global ordering or exactly-once external effects.
Web Crawler: Bloom filter
What it means: A Bloom filter is a compact membership structure whose positive answer may be a false positive; under the usual insert-only protocol a negative answer means the key was not inserted.
Why this problem needs it: A compact hint may reduce exact seen-state reads.
How to use it: Hash inserted identities into bits. Use a positive result as a reason to consult exact state when skipping a real item would violate the contract.
Example in this design: A Bloom positive triggers an exact check when falsely skipping a new URL is unacceptable.
When it fits: Useful when avoiding unnecessary exact lookups matters and the false-positive policy is acceptable.
Alternative and limits: An exact set costs more memory but avoids that ambiguity. A Bloom positive cannot safely prove that a URL was already durably accepted.
Web Crawler: Lease, ownership epoch and fencing
What it means: A lease grants temporary work ownership. A fencing token or epoch identifies a newer owner so stale owners can be rejected at the mutation boundary.
Why this problem needs it: A timed-out fetcher can overlap a reassigned URL.
How to use it: Claim a job under an atomic authority, increment its attempt/epoch, and require that value on result publication. The protected resource must enforce the check.
Example in this design: Use a current attempt token before publishing a fetched result.
When it fits: Useful when workers can pause, restart or overlap after a timeout.
Alternative and limits: A non-expiring lock risks blocking forever. Lease expiry alone cannot stop an old process that resumes; external effects need their own supported idempotency/reconciliation.
Web Crawler: Server-Side Request Forgery (SSRF)
What it means: SSRF occurs when an attacker causes a server to fetch a destination it should not reach, such as internal or metadata services.
Why this problem needs it: Crawling follows untrusted URLs and redirects.
How to use it: Validate normalized destinations and resolved addresses, enforce outbound network restrictions, and recheck redirects/resolution under the chosen policy. Bound bytes, time and decompression.
Example in this design: Reject internal targets at every allowed redirect and bound body/decompression work.
When it fits: Required for crawlers, imported URLs or any untrusted server-side fetch target.
Alternative and limits: Fetching only a trusted allowlist is simpler. Blocking one URL string does not protect against redirects, alternative address forms or resolution changes.
Interview scope and guarantees
Accept seed URLs, fetch permitted pages, discover links, deduplicate work, and revisit changed pages. Define crawl scope, robots policy and retention. Fetch success is separate from parsing success; every stage needs bounded resources.
Capacity worksheet
Assume 100 million pages/day at 100 KB compressed each: 10 TB/day and about 1,157 fetches/s average. With 500 ms mean service time, Little’s Law gives about 579 concurrent fetches before headroom. Per-host politeness can dominate aggregate capacity, so unlimited workers do not imply faster completion.
Concrete API contract
POST /crawls {seeds,scope,maxPages} -> {crawlId}
GET /crawls/{id} -> {counts,state}
Internal claim {host,leaseGeneration} -> due URL
Internal complete {url,attempt,status,contentHash}Data model and access paths
urls(normalized_url_hash PK,url,host,state,next_fetch_at,content_hash)
frontier(host,due_at,url_id,priority)
fetch_attempts(url_id,attempt,generation,status,object_key)
host_policy(host,robots_version,next_allowed_at)Evolve a solution and explain each change
Read the diagram
Fetch a frontier / Persist URLs and fetch pages with clear network and size limits. / Duplicates and cycles can exhaust work; unrestricted requests create an SSRF risk.; Schedule by host / Deduplicate normalized URLs and apply robots and per-host politeness. / One fast global queue can still overload a single host.; Lease and recover / Separate fetch/parse stages, fence attempts, and checkpoint discoveries durably. / Retries can duplicate discoveries or lose them after a worker crash.
Step 1: Fetch a frontier
Persist URLs and fetch pages with clear network and size limits. Duplicates and cycles can exhaust work; unrestricted requests create an SSRF risk.
Step 2: Schedule by host
Deduplicate normalized URLs and apply robots and per-host politeness. One fast global queue can still overload a single host.
Step 3: Lease and recover
Separate fetch/parse stages, fence attempts, and checkpoint discoveries durably. Retries can duplicate discoveries or lose them after a worker crash.
Responsibility overview
Read the diagram
Seed submitter to Frontier API: enqueue seed URL; Frontier API to URL state DB: deduplicate frontier; URL state DB to Host scheduler: eligible host work; Host scheduler to Crawler worker: lease polite fetch; Crawler worker to Website: bounded allowed fetch; Crawler worker to URL state DB: page and discoveries
Worked end-to-end scenario
A page links to itself and to the same article through two URL spellings. Normalize under a documented rule, then atomically insert the frontier key if absent. Worker W leases a URL, checks robots and the host’s next eligible time, and fetches with redirect, payload, and address restrictions. It persists the result before enqueuing discovered links. If W crashes after storing the page, retrying should not erase its discoveries; use an outbox or replayable parse stage. A robots response failure needs an explicit conservative policy. DNS and redirect checks must also prevent a public URL from reaching protected internal addresses.
Why these access paths matter
Frontier entries include normalized URL, host, next fetch time, attempt, and state. Index ready jobs by eligible time and keep host rate state separately. Content hashes can reduce duplicate storage but should not suppress required link processing silently. A Bloom filter can reject definite absence efficiently; possible presence requires exact lookup when skipping a fresh URL is unacceptable.
Build the baseline first
Read the diagram
Seeds → normalized URL frontier → polite scheduler; Fetcher → bounded response → object storage; Parser → validated discovered links → dedup frontier
- Seeds → normalized URL frontier → polite scheduler.
- Fetcher → bounded response → object storage.
- Parser → validated discovered links → dedup frontier.
Evolve the design under load
Read the diagram
Host partitions → fair due-time queues; Content hashes → duplicate-content detection; Revisit planner → conditional requests → freshness state
- Host partitions → fair due-time queues.
- Content hashes → duplicate-content detection.
- Revisit planner → conditional requests → freshness state.
Defend the hardest decision
URL normalization must preserve semantic differences: blindly dropping query parameters can merge distinct pages. Keep exact deduplication for required correctness and use a Bloom filter only as an optional fast membership hint. Schedule by host so one domain cannot occupy every worker. A durable per-host next-allowed time coordinates polite access across workers; a separate connection cap limits slow hosts.
Failure and recovery analysis
A URL resolves to a private network address after initial validation. Revalidate destinations on connection and after redirects to resist SSRF and DNS rebinding. Bound redirect count, decompressed size, total time and parser resource use. On worker death, reclaim the lease with a newer generation, and ignore stale completion writes.
Security and privacy boundary
Respect robots and site access policy, identify the crawler, and avoid fetching authenticated or private resources without permission.
Interview follow-ups with reasoning
Question: How do you avoid crawler traps?
Show answer and explanation
Answer: Cap depth and URL variations and monitor repeated low-value patterns.
Question: How do you refresh efficiently?
Show answer and explanation
Answer: Use last-modified or entity tags when supported and prioritize by measured change rate.
Question: How do you recover the frontier?
Show answer and explanation
Answer: Persist scheduling decisions and rebuild derived priority indexes from URL state.
Operate and verify the design
Per-host fetch rate, oldest frontier age, parser failures and duplicate discoveries.
Introduce a calendar trap and a slow host; verify unrelated hosts continue within their budgets.
A second scenario to test transfer
One host exposes a calendar with links to every future month. A naive crawler continuously discovers new URLs and starves other sites. A host-level discovery budget and pattern-aware scope stop the expansion. Another host returns 429; its next fetch is deferred while unrelated eligible hosts continue. Fair scheduling matters more than adding download workers.
Why can a global FIFO waste capacity even when thousands of URLs remain?
Show answer and explanation
Answer: The next URLs may belong to hosts that are delayed, throttled, or already at their concurrency limit. Eligible-host scheduling can make progress on other hosts without violating per-host policy.
Compare alternatives
| Concern | Mechanism | Trade-off |
|---|---|---|
| Politeness | Per-host scheduling | Lower peak speed per host |
| Infinite discovery | Budgets and scope rules | May miss low-priority pages |
| Duplicate content | Fingerprints | Hash/storage cost |
| Freshness | Adaptive recrawl | Scheduling complexity |
A design-changing exercise
A fetch succeeds but the worker crashes before discovered links are enqueued. How is coverage recovered?
Show answer and explanation
Answer: Persist parse/discovery intent with the fetched result or keep a replayable parse job. Acknowledging the frontier entry alone can lose traversal work.
Design workshop: schedule eligible hosts, not just URLs
Core scope is allowed HTTP(S) fetch, parse, discover and recrawl; login/cookie scraping is excluded. Choose one in-flight fetch per host and an illustrative one-second host interval. These are crawler policy assumptions, not permissions granted by robots.txt. Per-host budgets and overall page/byte limits remain mandatory for bounded work.
Store urls(normalized_url UNIQUE,host,state,next_fetch_at,attempt_generation), hosts(host PK,next_eligible_at,inflight,robots_version), fetches(url,generation,object_key,checksum,status), and parse_jobs(fetch_id UNIQUE,state,version). Normalize fragments and host case, preserve meaningful query parameters and path case, and document redirect/canonical handling. A URL fingerprint is an accelerator; exact normalized identity decides duplicates.
while capacity_available():
host = claim_earliest_eligible_host(now) # fenced lease/transaction
if not host: break
url = claim_due_url(host)
if not url:
release_host(host); continue
reserve_host_slot_and_next_time(host, now + politeness_interval)
enqueue_fetch(url, host.lease_generation)Host claiming atomically verifies inflight capacity and next eligible time. A min-heap over eligible hosts avoids a FIFO blocked behind one throttled domain. Persist next times/leases so restarts do not unleash all URLs at once. On 429 honor applicable Retry-After and back off the host; a trap creating infinite calendar pages hits per-host discovery and depth/URL budgets.
Read the diagram
Lease allowed URL and host slot generation 4; Persist capped response bytes and fetch record; Emit parse job for immutable fetch identity; Claim parse job; read stored response; Commit discoveries and parsed checkpoint; Crash recovery retries missing stage, not every network fetch
Robots handling follows the protocol distinction: a 4xx unavailable robots resource may permit access under the RFC, while server/network errors make it unreachable and require initial complete disallow; cached rules and prolonged-unreachable treatment have documented boundaries. This crawler chooses the conservative policy of delaying on network/5xx failures and refreshing cached rules normally within 24 hours. Follow redirects under a bounded policy and evaluate rules for the applicable origin. Robots is not authentication or a blanket legal access grant.
Read the diagram
Condition / Decision / Recovery; robots 404 / No applicable rules under chosen policy / Fetch within host budgets; robots network/5xx / Conservative disallow for now / Retry with backoff; retain safe cache policy; URL resolves private/link-local IP / Reject before connecting / Log rejection; do not follow to internal origin; Redirect or DNS change / Validate each destination and resolved IP / Pin connection to validated address; Response too large / Abort at byte/time cap / Record bounded failure; do not parse unbounded bytes
For SSRF defense, resolve, validate every returned candidate address and connect to a validated address without an independent uncontrolled re-resolution. Validate redirects and preserve TLS hostname checks. Restrict egress at the network layer as well; URL parsing alone is insufficient. Decompression has an expanded-byte cap so a tiny compressed response cannot exhaust memory.
A Bloom hint for n=10 million URLs at p=0.01 needs approximately −n ln(p)/(ln2)^2 =95.9 million bits, about 12 MB, with about seven hashes. A positive can be false, so skipping it without an exact check can miss new pages. At 1,000 fetches/s averaging 200 KB, ingress is 200 MB/s; provision parsing and storage throughput separately. Recrawl prioritizes change likelihood and desired freshness with per-host fairness.
Exercise: A worker persisted bytes but crashed before parsing. Should recovery refetch immediately?
Show answer and explanation
Answer: If the durable fetch record validates the object and parse identity, resume parsing that object. Refetch only if missing/corrupt or recrawl policy requires a newer version. This separates duplicate network cost from idempotent discoveries.
Robots Exclusion Protocol, RFC 9309 is the primary source for robots status handling.
Requirement trace and verification
| Requirement | Implementing design block | Verification link |
|---|---|---|
| R1 — Complete the primary user journey within the stated scope. | P01–P04; P09–P10. | V1 — Exercise the successful journey and the excluded/boundary case stated in the scope. |
| R2 — Preserve the problem's authoritative data invariant under concurrency. | P05–P06; P11–P12; DD1. | V2 — Run the race/replay case below and assert the invariant at the durable authority. |
| R3 — Meet the declared scale and API behavior without unbounded work. | P05–P08; P13–P14; relevant overload deep dives. | V3 — Exercise the API errors/retry identity and recompute the workload assumption that drives partition or capacity. |
| R4 — Recover from the named failure without losing or duplicating the user-visible outcome. | P15–P16; deep dives; Operations contract. | V4 — Crash after storing content, retry a timeout, introduce a redirect loop, and flood one domain; progress persists without violating host budgets. |
Operational contract
| Area | Decision and signals |
|---|---|
| SLIs | Oldest frontier age; per-host fetch rate; robots-policy age; parser failures; duplicate-content ratio. |
| Overload limits | Enforce per-host delay/concurrency, global worker slots, frontier quotas, response-byte cap, and retry budget. |
| Recovery | Resume from durable leases and checkpoints; quarantine poison URLs; reconcile stored content before acknowledging fetch. |
| Access controls | Honor robots/allowlists and SSRF protections; deny private network targets and restrict outbound worker access. |
| Dominant cost | Bandwidth, page storage/retention, and parsing compute. |
Senior-level interviewer follow-ups
Question: How do you ensure two workers do not crawl one host too quickly?
Show answer and explanation
Answer: Use a host-level scheduler lease and next-eligible time, not just global queue concurrency. Recheck the host policy before dispatch and account for redirects to a different host.
Question: A page redirects to a private IP after DNS resolution. How do you prevent SSRF?
Show answer and explanation
Answer: Resolve and validate every destination, pin the checked address for connection, block private/link-local ranges, and repeat validation across redirects. Apply egress controls as a second boundary.
A 60-second design answer
I would put deduplicated URLs into a scheduler that enforces per-host eligibility and robots policy. Fetch workers claim leases, validate every DNS target and redirect against SSRF rules, and use bounded time and bytes. Parsing discovers new links into the frontier. I would monitor frontier age, host delay, fetch errors, redirect loops, duplicate rate, and storage per crawled page.
Related concepts to revisit
Managing Long Running Tasks Elasticsearch
Technical references
PostgreSQL transaction isolation and concurrent updates.
Dispatch one host without violating politeness
Host h1 may next run at time 12. Frontier entries u1,u2 are both due at 10; only the owner holding h1's lease dispatches one at 12, then advances the host deadline under the declared crawl-delay policy. Multiple workers checking the old deadline independently can overrun the host even if URL deduplication succeeds.
h1 next_allowed=12
u1,u2 due=10
at 12: lease + dispatch u1; advance host deadline
u2 waits; failed attempt keeps its URL/job identityRead the diagram
h1 next_allowed=12; u1,u2 due=10; at 12: lease + dispatch u1; advance host deadline; u2 waits; failed attempt keeps its URL/job identity
Normalize URLs according to a declared policy without incorrectly merging semantically distinct query strings. A Bloom hit is “possibly fetched” and needs exact confirmation when completeness matters. Apply robots rules at their applicable host/scheme scope, bound redirects/body size/time, and validate destination addresses at each redirect/connect boundary against SSRF policy. Durable checkpoints preserve frontier progress; a crash may replay an attempt, not skip it silently.
Show answer and explanation
Answer: A redirect to a private address is not allowed merely because the starting URL was public. URL dedupe, host rate control and network safety are three distinct state/validation boundaries.
Decision review: Web Crawler
Web Crawler: What it is
A crawler discovers and fetches URLs under scope, politeness, safety and resource constraints.
Web Crawler: Why it is needed
The frontier can expand without bound, and a fetch target can redirect into forbidden networks or produce unbounded data.
Web Crawler: When to use it
Use a durable frontier when accepted work must recover; define permitted hosts/content and robots/politeness policy before increasing parallelism.
Web Crawler: How to use it
Normalize URLs under the product policy, preserve fetch-job identity, schedule bounded per-host work and verify network destinations across resolution and redirects. Limit bytes, time, decompress expansion and parsing resources.
Web Crawler: Compare an alternative
Broad discovery improves coverage but raises storage, duplicate and safety costs. A restricted sitemap or allowlisted crawl is simpler for a narrower product.
Web Crawler: Worked decision exercise
The following inputs and policies are original exercise assumptions; they are not measurements or undisclosed company behavior.
Jobs J1 and J2 reach host H at once, but its budget permits one active fetch. J1 redirects to an internal address. That redirect must fail the destination policy; the earlier public URL check is insufficient.
Read the diagram
Host H permits one active fetch, not one per worker; J1 redirects from public URL to a blocked address; Recheck destination across the redirect chain; Seen state must not strand unaccepted frontier work
Can marking a URL seen before durable frontier acceptance lose it after a process crash?
Show answer and explanation
Answer: It can if seen state prevents later discovery while no recoverable job exists. Coordinate accepted frontier work and seen/attempt state under the declared policy. Retry a lease loss using stable work identity while respecting the host budget.
Web Crawler: Check the design
Observe host concurrency, frontier age, response size, blocked destinations and duplicate fetch effects. Test redirect chains, large decompression and failure between seen-state and enqueue.
Crawler extension: follow progress across stage boundaries
Use the existing frontier and host-scheduling baseline first. The workshop below extends its contract across redirect targets, expired worker leases, verified result publication, partial discoveries and conditional recrawl. A completed network response, accepted result, parsed page and admitted outgoing links are separate milestones.
Deep dive: a stored page is not completed crawl coverage
The existing walkthrough already covers durable frontier admission, host scheduling, robots, network restrictions and bounded parsing. This workshop makes redirect dispatch, uncertain fetch lifetime, parse replay and recrawl revision boundaries explicit. It is an original crawl protocol sketch, not a fetch client or a production network-isolation implementation.
Keep work identity separate from content identity
A crawl owns scope/version, page and byte budgets, allowed origins and retention policy. A normalized URL is an identity under that crawl's documented normalization policy, not a universal statement that two resources are equivalent. Preserve meaningful query parameters/path case; fragment removal and host normalization do not authorize dropping every query string. Store the canonical URL alongside its fingerprint to resolve collisions and normalization-version changes.
frontier(crawl_id, normalization_version, canonical_url, url_id,
requested_revision, state, next_due, attempt_epoch)
fetch_result(url_id, requested_revision, attempt_epoch, request_variant,
final_url, status, verified_object, validator, fetched_at)
parse_job(fetch_result_id, parser_version, state, output_manifest)
discovery(parse_job_id, link_identity, normalized_target, disposition)
origin_budget(scheme, host, port, policy_version, next_start, active_tokens)Atomically establish exact accepted frontier identity and durable work before a seen hint can suppress rediscovery. A Bloom positive is not proof of accepted work. Content hashes may share immutable bytes across fetches, but the parse identity also depends on source URL/base URL and parser version. Two pages with identical relative link text can resolve to different target URLs; content dedupe must not silently skip the required discoveries.
Redirects require a new target's admission decision
Choose a conservative rate key, such as scheme/host/effective port, and document whether related hostnames also share a site-level quota. A source-origin slot does not authorize requests to a redirect destination. Resolve a redirect location under the current URL, validate scope and network destination, obtain the target origin's robots/politeness/concurrency grant, and then dispatch under the same bounded redirect chain. Release the completed source hop's slot according to the actual network outcome. Waiting for a target must not retain an unbounded chain of occupied source slots.
A redirect into another origin does not import the source origin's robots rules. Robots retrieval redirects have their own protocol semantics; a robots fetch does not turn every redirected page into an allowed crawl target. The Robots Exclusion Protocol distinguishes unavailable and unreachable responses and states that robots rules are not access authorization. Retain the baseline's conservative server/network-error policy; per-origin crawl intervals here are exercise policy, not a claim that robots.txt universally specifies a request rate.
Network validation and politeness are independent. Enforce allowed HTTP(S) schemes, scope, controlled DNS resolution and actual connected-address policy on every hop, with TLS hostname validation and network egress restrictions. Do not validate one DNS answer then let a library independently resolve a different address for connection. Revalidate alternate/retried connections too. Pool reuse/proxy routing must preserve this destination contract; string checks alone cannot establish it. Bound redirect hops, cumulative deadline, compressed and expanded bytes, parser CPU and link count across the whole logical fetch, not afresh on each redirect.
Fence publication without pretending to stop a remote request
Host start-time spacing and concurrent active requests are different budgets. Claiming a URL under epoch 8 prevents an epoch 7 completion from replacing current durable state, but it does not stop epoch 7's socket or the remote server. If lease expiry immediately frees the only origin slot while the old network request still runs, two requests can overlap despite a nominal one-at-a-time policy.
Keep network slot tokens until the fetch gateway has observed termination under its contract. Use an enforceable egress/gateway authority to revoke or finish old attempts before admitting replacement concurrency, or state a bounded-overlap policy and account for that exposure explicitly. If stop evidence is unknown, preserve the unresolved slot/liability and shed or delay work. A request can have reached the remote server before a connection fails; exactly-once external fetching is not guaranteed by an internal lease. Worker recovery preserves work identity and charges duplicate network effort to a finite retry budget.
Commit verified bytes and replayable parse intent together
Read the diagram
Durable fetch output permits parse recovery; an HTTP success alone does not prove traversal progress.
Write an immutable result object and verify the recorded checksum/length. Then commit its accepted fetch record and parse intent under the current URL revision/attempt authority. An upload not referenced by an accepted record is an orphan with a bounded cleanup contract. A stale worker may leave orphan bytes but cannot overwrite the current result or mark a newer revision complete. Object publication, abandon/GC and the supported reader lifetime need coordinated ownership as in the blob-store lesson.
A parser can discover many links. Persist batches of stable discoveries and their enqueue/disposition intents, or publish a verified finite manifest for replay; do not advance the parse completion checkpoint merely because some output pages were emitted. Commit each target's exact frontier admission before acknowledging the corresponding discovery intent. Keep source parse progress independent from target fetch completion. Retries deduplicate (parse_job, link_identity) and accepted frontier identity; different parse versions can reuse bytes without deleting previous progress evidence.
If result O is missing or corrupt, do not mark J successfully parsed. Recover an integrity-checked replica or schedule a new allowed fetch under current policy/budgets. A successful HTTP status with an oversized body, unsupported content or parser failure has its own explicit disposition. Coverage counters distinguish fetched, verified, parsed, intentionally skipped, failed and deferred URLs. “Seen” is not a synonym for all of them.
Recrawl is a new revision with compatible validators
A revisited URL uses a requested revision and current attempt epoch. Old revision 7 can finish after revision 8; it may be retained as history, but cannot replace revision 8's current content/parse status. Under HTTP conditional response semantics, a not-modified response refers the client to a stored representation. This exercise requires available compatible previous bytes and validator/request variant; it does not create page bytes when the previous object was already collected. If required prior bytes/evidence are absent, perform an allowed unconditional fetch or report incomplete recovery rather than asserting successful coverage.
Record the representation's validator, source URL, request variant and parser version used by the conditional request. A changed parser may still need to reprocess the preserved body even when the server says the representation did not change. Do not use a fresh 304 timestamp as proof that every derived index/parser output is current. Stable result identity and separate parse generations make that distinction inspectable.
Bound breadth, host fairness and recovery
Suppose parsing 1,000 pages/s yields 100 accepted new links/page while fetching remains 1,000 URLs/s. Frontier growth is roughly 99,000 URLs/s before duplicates/scope rejection; more parser workers make that imbalance worse. Enforce crawl-wide, origin, depth, query-pattern and byte budgets with explicit deferred/rejected dispositions. Reserve finite capacity for recrawl and priority seeds so a calendar trap cannot occupy all accepted work. A full frontier needs backpressure/admission policy, not an unbounded queue.
If parse ingestion is 1,000 jobs/s and stops for ten minutes, at least 600,000 jobs accumulate. At 1,500/s recovery with 1,000/s fresh input, useful drain is 500/s and takes 1,200 seconds before overhead. Four-megabyte expanded bodies for 500 concurrent parsers can require two gigabytes of body memory alone; streaming can reduce residency but not remove CPU, per-body or total expanded-byte limits. Budget network, storage, parse and discovery stages independently.
Track oldest eligible frontier/parse age, blocked-origin time, unresolved network slots, redirect-target admission, stale completion rejection, verified-object failures, parse/discovery gaps and finite-budget dispositions. Canary parser/normalization versions under compatible replay rules. Stop new crawl dispatch on rollback while preserving accepted results and pending discoveries; removing a worker deployment does not complete or cancel its external requests.
Crawler assessment: prove coverage without inventing network guarantees
Question: A public origin redirects to another public origin whose sole fetch slot is occupied. Can the crawler follow immediately under the first origin's slot?
Show answer and explanation
Answer: No. Validate the destination and obtain its own applicable policy/rate/concurrency grant. Waiting and redirects remain under finite chain/deadline budgets.
Question: A fetch worker's lease expired. Does that alone prove its network request stopped and its host concurrency slot can be reused?
Show answer and explanation
Answer: No. Fence stale durable publication, but resolve actual network lifetime through the gateway/stop evidence or a declared bounded-overlap policy before claiming strict concurrency.
Question: Verified bytes were stored before a crash, but no discoveries completed. Must recovery refetch immediately or mark the URL covered?
Show answer and explanation
Answer: Neither by default. Resume the stable parse job from the accepted verified object and recover discovery admission. Missing/corrupt bytes or a newer recrawl policy require an explicit different recovery path.
Score one point for exact scoped frontier/content/parse identities, per-hop origin and network admission, honest stale-attempt/network-slot lifetime, verified replayable parse/discovery progress, and recrawl/validator/capacity boundaries. Compare Priority Job Queue, Distributed Blob Store and Security and Tenant Isolation.
Why can a global FIFO waste capacity even when thousands of URLs remain?
Your design draft
Clarify assumptions, explain your approach, and test the difficult cases. Save your draft, then compare it with the study notes.
Self-review checklist
Self-guided practice. Automated AI feedback and code execution are not connected.