Scrape Info

Large-Scale Web Crawling Architecture Patterns

Prioritized queues, domain affinity, and deduplication keep crawlers fast and polite at scale.

Columnist · · 10 min read
Cover illustration for “Large-Scale Web Crawling Architecture Patterns”
Crawling & Sitemaps · August 12, 2026 · 10 min read · 2,353 words

The frontier is not a queue. It's more accurate to say it's a queue that developed strong opinions somewhere along the way and refuses to let just anything jump to the front.

Technically, it's a prioritized, deduplicated, politically-aware scheduling system. It tracks which URLs to visit, their priority scores, which domains they belong to, and when each domain was last fetched. That last detail is the one that catches people off guard when they build their first crawler.

Priority scoring

Not every URL deserves the same crawl slot. The frontier assigns priority based on a few things:

  • Link signals. Pages with more inbound links from important pages move up the line.
  • Freshness decay. A page that changes daily gets revisited more often than one that's been static for two years.
  • Domain importance. A news homepage carries more signal than a deeply nested archive page on the same site.

The sharding problem

For politeness reasons, URLs from the same domain have to route to the same worker. You can't have three workers hitting the same server with zero coordination between them. Consistent hashing solves this: each domain maps to a specific worker bucket, and URLs follow.

Front queues and back queues

Most frontier implementations run two queue layers.

  • Front queues enforce priority. They sort URLs by score and decide what moves forward.
  • Back queues enforce politeness. Each back queue maps to a domain or domain group and holds URLs waiting their turn based on the last fetch time.

Drop the front queues and your crawler visits junk before gold. Drop the back queues and it hammers servers until something breaks. One important thing worth noting here: billions of URLs don't live in memory. The frontier needs persistent storage behind it, usually a distributed key-value store or a disk-backed queue. If you skip that, a single restart erases your entire crawl state.

Distributing Fetch Workers Without Creating a Politeness Problem

The basic model is simple. A pool of workers pulls URL batches from the frontier and fetches them using asynchronous I/O. Async matters because network wait time is the dominant cost. A sequential crawler is idle for most of its operating life. Sending multiple requests simultaneously makes full use of available bandwidth.

Domain-to-worker affinity

Each worker owns a set of domains. This is how you enforce per-domain rate limits without a central coordinator becoming a traffic bottleneck. The worker already tracks its own domains and knows when each was last fetched. In practice, politeness mechanics look like this:

  • A minimum delay between requests to the same domain, respecting whatever crawl-delay is specified in robots.txt
  • Per-domain rate limiting, so one slow domain doesn't starve everything else
  • Exponential backoff when a server returns a 429 or 503

The memory problem nobody catches until production

Long-running workers accumulate state. Parsing malformed HTML is a particular offender. It generates heap allocations that don't get cleaned up properly, and after several hours you end up with workers that are technically running but functionally falling apart. The fix is to restart workers after roughly 1,000 tasks or every four hours, whichever comes first, combined with memory monitoring and circuit breakers. It sounds inelegant. It holds up in practice.

Geographic placement and orchestration

Co-locating fetch workers near target servers reduces latency and lowers the chance of triggering geo-based bot detection. Sites get suspicious when request clusters arrive from regions that don't match their normal traffic patterns.

Past a few thousand concurrent requests, you need an orchestration layer. Celery with Redis is a common open-source pattern. The queue distributes work, the workers consume it. The orchestrator doesn't need to be especially clever. It just needs to exist before things get chaotic.

Deduplication Across Billions of URLs and Page Contents

There are two distinct problems here, and conflating them is a genuinely expensive mistake.

URL deduplication asks: have we already crawled this URL? Content deduplication asks: have we already stored this content, regardless of which URL it came from?

Both matter. Ignoring either one costs you.

URL deduplication

  • Bloom filters are the standard answer at scale. They're probabilistic, meaning they occasionally flag a new URL as already seen. That trade-off is worth making because the storage savings at billions of entries are substantial.
  • Exact-match hashing in a distributed key-value store is the right call when false positives are genuinely costly. For instance, when missing a URL means missing content that won't surface again through other paths.

Content deduplication

This is the trickier half. Printer-friendly pages, session-parameterized URLs, and syndicated content can generate dozens of near-identical pages from different URLs. Without content dedup, your storage grows faster than the actual information you're collecting.

  • SimHash generates a fingerprint that's similar for similar documents. It catches near-duplicates without requiring a full pairwise comparison across the corpus, which would be computationally unworkable at scale.
  • MinHash with locality-sensitive hashing (LSH) is an alternative that trades some accuracy for a lower memory footprint.

URL dedup happens before fetching, at the frontier. Content dedup happens after fetching but before storage. Both are online operations. If either one falls behind the fetch rate, it becomes the bottleneck. This is not a theoretical concern; it's something you'll discover painfully if you don't plan for it upfront.

Venn diagram: URL vs. Content Deduplication. Compares URL Deduplication and Content Deduplication; overlap: Shared Properties.

Storage Architecture for Petabyte-Scale Crawled Content

A production crawl produces several distinct categories of data:

  • Raw HTML or WARC files
  • Extracted structured content
  • Crawl metadata (fetch time, HTTP status, redirects)
  • The deduplication index itself

WARC format and what it costs you

WARC is the standard for archival-grade crawl storage. It captures raw HTML, JavaScript, and full request/response metadata. Common Crawl's August 2025 crawl produced over 419 TiB of data from 2.42 billion pages. That's one crawl cycle. The storage pressure this creates is not hypothetical.

Tiered storage

The practical split:

  • Hot tier. Recently crawled, high-freshness content that downstream pipelines access regularly.
  • Cold tier. Archival content, rarely queried, stored cheaply on object storage.

Object storage (S3-compatible systems) is the foundation for the cold tier and often the hot tier too. The AWS reference architecture for web crawling uses S3 for crawl output, AWS Batch for orchestrating jobs, and ECS containers on Fargate for the actual fetching. Object storage scales to petabytes without requiring you to do capacity planning rituals every quarter, which is why this pattern repeats across so many teams.

Worth flagging: WARC files are computationally heavy, and AI pipelines rarely want raw HTML. That tension is what motivates the processing step covered next.

Turning Raw Crawl Output Into Content AI Pipelines Can Actually Use

Raw HTML fed into an LLM is full of navigation menus, footers, ads, inline scripts, and layout tags that are pure noise. That noise burns context window and reduces signal quality. A 2025 benchmark study called NEXT-EVAL found that LLMs can achieve F1 scores above 0.95 on structured web extraction, but only when input is properly formatted. The model isn't the bottleneck. The data format is.

Markdown as the dominant LLM-ready format

Markdown has become the standard output format for crawl pipelines feeding AI systems, and not arbitrarily:

  • It preserves semantic structure (headings, lists, links, code blocks) while stripping layout noise
  • It's token-efficient. Some implementations cut token usage by up to 80% compared to raw HTML
  • It enables precise RAG chunking. Retrieving content under a specific heading is far more accurate than extracting from a flat HTML dump

JSON vs. Markdown

These serve different use cases rather than competing with each other.

  • JSON works best when the downstream system expects structured fields. Explicit, parseable, reliable for extraction tasks.
  • Markdown works better for text-heavy use cases like summarization and retrieval-augmented generation, where document flow and hierarchy matter.

Research from a paper called AXE found that stripping boilerplate HTML before passing content to an LLM cut token usage by 97.9% without degrading extraction quality. That's not a rounding error. The cleaning step is load-bearing for teams running efficient AI pipelines on crawled data. Either you build that layer yourself, or the tool you use for fetching provides it.

Fault Tolerance and Operational Resilience Across the Full Pipeline

A distributed crawler has a wide failure surface. Bad URLs, malformed HTML, unreachable hosts, overloaded servers, worker crashes, queue backlogs, storage write failures. Any of these can cascade if unhandled. The discipline here is managing failures without breaking the other properties the system is supposed to maintain.

Key resilience patterns

  • Retry with dead-letter queues. Failed fetches go to a dead-letter queue for inspection rather than being silently dropped. This is how you distinguish systematic failures (a domain blocking all your requests) from transient ones (a momentary timeout).
  • Checkpointing the frontier. If frontier state is lost on crash, the crawl restarts from scratch. Periodic snapshots to durable storage prevent that.
  • Circuit breakers at the domain level. If a domain returns repeated errors, stop sending requests to it temporarily. This protects your own throughput and avoids getting permanently blocked.
  • Worker lifecycle management. The 1,000-task / 4-hour restart pattern keeps worker behavior predictable over days of operation and prevents the memory accumulation problem from compounding.

What to actually monitor

Pages per second. Fetch error rate by domain. Frontier depth (is the queue draining or growing?). Deduplication hit rate. Storage write latency. These metrics show you where the system is stressed before the stress becomes a failure.

One thing that bites people consistently: if your retry logic ignores robots.txt crawl-delay, your crawler will violate politeness at exactly the wrong moment, when a target server is already under stress. Exponential backoff needs to be coordinated with politeness constraints, not treated as a separate concern.

Centralized vs. Distributed vs. Managed: Choosing the Right Architectural Footprint

Each option comes with a real operational surface, not just a different price tag.

Centralized (single machine). Fine for focused, small-scale crawls. You'll hit the ceiling faster than you expect, and there's no way to negotiate your way past single-node throughput limits.

Distributed self-hosted. Workers spread across machines, coordinated by a queue. Horizontal scalability unlocked. You also own the full operational surface: queue management, worker lifecycle, frontier persistence, deduplication indexes, proxy infrastructure, and anti-bot handling. This is a genuine engineering commitment.

Cloud-native reference pattern. AWS Batch for job orchestration, ECS/Fargate for containerized fetchers, S3 for storage. Infrastructure elasticity without managing bare metal, but substantial operational ownership remains. You're trading one kind of complexity for another.

Managed crawling APIs. You externalize the infrastructure entirely. Recurring cost in exchange for zero operational overhead on proxies, anti-bot handling, scaling, and maintenance.

The cost reality

A three-person engineering team running an in-house scraping solution costs somewhere in the tens to hundreds of thousands of dollars annually when salaries, infrastructure, and maintenance are factored in. Managed services start lower and scale with volume. The math depends on your scale target and crawl frequency.

The more useful question is whether the crawl is a core product capability or an infrastructure dependency. Teams building AI pipelines on live web data often find the managed path faster to production because the crawling infrastructure itself isn't their differentiator. The data is. The models built on top of it are.

What the Managed API Ecosystem Looks Like for Teams That Don't Want to Operate Crawl Infrastructure

The options in this space are not all built the same way, and the differences matter depending on what you're actually trying to do.

Firecrawl is the largest open-source project in this area, with hundreds of thousands of GitHub stars, used by teams at companies like Apple and Canva, serving billions of requests. Its /agent endpoint accepts a research prompt and autonomously browses multiple sources without requiring you to write orchestration code. Its /interact endpoint handles session-aware scraping (clicks, forms, logins). For developer teams that want open-source roots and a large community, it's a credible first option.

Crawl4AI is open-source and self-hosted, built specifically for LLM data pipelines. It uses Playwright for JavaScript rendering and outputs both rawmarkdown and fitmarkdown (boilerplate stripped). It ships a built-in MCP server in its Docker deployment, meaning agent frameworks can call it mid-conversation. It integrates natively with LangChain, LlamaIndex, and vector stores like Milvus, Qdrant, and Supabase. If you want to self-host and you're feeding a RAG pipeline, this is built for exactly that use case.

Olostep covers web search, scraping, crawling, site mapping, batch processing, and web monitoring. It delivers clean Markdown, HTML, or JSON rather than raw HTML. Native Python and Node.js SDKs, webhook events, an MCP server, and CLI tooling make it accessible whether you're writing code or running autonomous agent pipelines.

The questions worth asking when evaluating any of these

  • Does it return AI-ready output formats (clean Markdown, structured JSON) or raw HTML?
  • Does it handle JavaScript rendering, anti-bot measures, and proxy rotation without you having to manage those pieces separately?
  • Can autonomous agents call it directly, or does every request require a human-authored orchestration layer around it?
  • What does cost look like at the specific request volume your team actually runs?

Where the Architecture Decisions Compound: Lessons from Operating at Real Scale

Every component in this stack is connected to every other component. That sounds obvious, but people underestimate how quickly the connections become painful.

A poorly designed frontier creates politeness violations in the fetch layer. Weak deduplication inflates storage costs and pushes redundant data into downstream pipelines. Fault tolerance logic that ignores politeness constraints causes violations at the worst possible moment. Skipping the content-cleaning layer means your AI pipeline is burning context window on noise it should never have received.

The four properties a production crawler has to balance — horizontal scalability, politeness, fault tolerance, and freshness — genuinely pull against each other. Maximizing throughput can break politeness. Prioritizing freshness can stress fault-tolerance mechanisms. There's no configuration where all four are trivially satisfied simultaneously. There's only the ongoing work of tuning them against each other as your crawl target and scale change.

For what it's worth, my strong read on this after watching teams build and operate these systems: the teams that struggle most are not the ones with the fewest engineering resources. They're the ones who discovered these trade-offs in production rather than before they started building. That's a much more expensive place to learn them.

Sources

  1. medium.com
  2. grokkingthesystemdesign.com
  3. brightdata.com
  4. blog.algomaster.io
  5. systemdesignhandbook.com

More in Crawling & Sitemaps