Asked at
URL Shortener (TinyURL)
Asked from Junior level upFoundations & Storage
Distributed Rate Limiter
Asked from Mid level upAPI Gateway & Security
Distributed Key-Value Store
Asked from Senior level upFoundations & Storage
Distributed Notification Service
Asked from Mid level upMessaging & Queues
Distributed Web Crawler
Asked from Mid level upDistributed Systems
Metrics & Monitoring Platform
Asked from Senior level upObservability & Time-Series
Real-Time Chat App (like WhatsApp or Slack)
Asked from Mid level upReal-Time & WebSockets
Social News Feed (like X/Twitter)
Asked from Mid level upSocial & Feed Systems
Ride-Hailing App (like Uber)
Asked from Senior level upGeospatial & Real-Time
Low-Latency Stock Exchange Matching Engine
Asked from Staff level upFintech & Low Latency
Global Video Streaming Platform (like YouTube or Netflix)
Asked from Senior level upMedia & Streaming
Distributed Hotel & Ticket Reservation System
Asked from Mid level upE-Commerce & Transactions
Shared Document Editor (like Google Docs)
Asked from Staff level upReal-Time & Distributed State
Game Leaderboard
Asked from Junior level upCaching & Data Structures
File Sync Service (Dropbox / Google Drive)
Asked from Mid level upStorage
Payment System
Asked from Senior level upPayments & Transactions
Ad Click Aggregation
Asked from Senior level upStream Processing
AI Support Assistant (RAG)
Asked from Senior level upAI Systems
LLM Inference Platform
Asked from Senior level upAI Systems
Enterprise Semantic Search
Asked from Mid level upAI Systems
AI Code Completion
Asked from Senior level upAI Systems
LLM Gateway
Asked from Senior level upAI Systems
AI Agent That Takes Actions
Asked from Senior level upAI Systems
LLM Evaluation Platform
Asked from Senior level upAI Systems
AI Document Processing Pipeline
Asked from Mid level upAI Systems

Design a Distributed Web Crawler

Asked from Mid level upDomain: Distributed Systems
Concepts to know first:

Design a scalable web crawler to download and index billions of web pages across the internet.

An analogy

Think of a web crawler like an explorer in a library with billions of cross-referenced books. It reads one book, writes down all the cited titles into a to-read list, and systematically visits each new title.

Where this design ends up. This is version 3 of 3. Part 5 builds it up from version 1 and says why each part was added.
  1. Clients
    • Seed URLs
  2. Services
    • Crawler service
    • Parser
  3. Queues, caches
    • URL frontier
    • DNS cache
    • Seen filter
  4. Data, outside
    • Web sites
    • Page store

1. Requirements and scope

Functional Requirements
  • Crawl web pages starting from seed URLs.
  • Extract HTML, extract outbound links, and store raw content in blob storage.
  • Respect robots.txt and website politeness policies.
Non-Functional Requirements & SLAs
  • Scalability: 1 Billion pages per month.
  • Be polite: never send so many requests at once that a website slows down.
  • Extensibility: Support pluggable document parsers.
Key Traffic Assumptions: 1 Billion pages crawled per month = ~400 pages/sec continuous download.

2. Back-of-the-envelope numbers

Writes and reads each second
  • Writes: 400 pages saved a second, on average (50%)
  • Reads: 400 DNS lookups a second (50%)

Balanced: reads and writes are close. Both paths need care, so neither can be slow.

Write Throughput
400 pages/sec (Avg), 1,000 pages/sec (Peak)
Read Throughput
400 DNS lookups/sec
Storage Growth
1B pages × 500 KB avg = ~500 TB / month (6 PB / year)
RAM Cache Footprint
Bloom filter with 10B URLs in RAM (~12 GB) for deduplication

3. API

POST/api/v1/crawler/seedsSubmit initial seed URL list
GET/api/v1/crawler/statsMonitor crawler throughput and queue depth

4. Data model and storage

Storage Strategy: S3/Blob storage for raw HTML + HBase/Cassandra for metadata + Redis for URL frontier.
PAGES: (url_hash, url, content_s3_path, etag, last_crawled_at, status_code)

5. The design, in three versions

Version 1: Single Threaded Crawler

Single script keeping URLs in a local queue and downloading sequentially.

Distributed Web Crawler: Version 1: Single Threaded Crawler Version 1 of 3

The picture follows one request through the parts of this version, in order. Under it, switch a part off to see what the request does without it.

One request, step by step

Each numbered arrow is one step. Press "Simulate Request Flow" to follow them one at a time.

Seed URLsCrawler serviceURL frontierWeb sitesPage store1234
  • The order of the steps
  • A request or its reply

The parts: switch one off

1. Clients

Seed URLswhere the crawl starts

2. Services

Crawler servicedownloads pages

3. Queues, caches

URL frontierqueue of URLs to fetch

4. Data, outside

Web sitesthe pages
Page storesaved pages

The steps in words0 of 4 steps shown

  1. Seed URLs to URL frontierHTTPS · 2 ms

    The seed URLs go into a queue in memory.

  2. URL frontier to Crawler servicecall · 3 ms

    One fetcher takes the next URL.

  3. Crawler service to Web sitesoutside call · 80 ms

    It downloads the page.

  4. Crawler service to Page storequery · 8 ms

    It saves the page on its own disk.

Why this version
Prototype validation.
Next bottleneck
Network I/O waiting blocks execution; crawls only ~5 pages/sec.

Write path, read path and failures

Each path follows one request through the final design (version 3), one hop at a time.

Write pathFetch and store one page

  1. URL frontier
  2. Worker
  3. DNS cache
  4. Web site
  5. Blob storage
  6. Bloom filter
  1. URL frontier to Worker

    A worker takes the next URL. The frontier only hands out a host that has not been fetched in the last 2 seconds.

  2. Worker to DNS cache

    The worker finds the host's IP address in a local DNS cache, so it does not ask DNS for every page.

  3. Worker to Web site

    It checks the site's robots.txt rules, then downloads the page.

  4. Worker to Blob storage

    It saves the raw HTML and records the page's details.

  5. Worker to Bloom filter

    It pulls the links out of the page and asks the filter which ones are new.

  6. Worker to URL frontier

    Only the new links go back into the frontier, in the queue for their host.

Read pathChoose the next URL

  1. Priority queues
  2. Host queues
  3. Delay queue
  4. Worker
  1. Priority queues to Host queues

    A router moves URLs from the priority queues into one queue per host. Important pages go first.

  2. Host queues to Delay queue

    After a host is fetched, its queue is parked for 2 seconds in a delay queue.

  3. Delay queue to Worker

    When the wait ends, the host's next URL is handed to a free worker.

What breaks, and what happens then

  • A worker crashes in the middle of a page

    What users see
    That URL is not finished.
    What the design does
    The frontier hands a URL out with a time limit. If no result comes back, it hands the URL to another worker.
  • A site is slow or returns errors

    What users see
    Workers would waste time waiting on it.
    What the design does
    Use short timeouts and retry later with a longer wait. After repeated failures, lower the host's priority.
  • A spider trap makes endless new URLs

    What users see
    The crawler fills up with useless pages from one site.
    What the design does
    Cap the pages per host and the depth of a URL, so one site cannot take over the crawl.
  • The Bloom filter gives a false positive

    What users see
    A new URL is treated as already seen and skipped.
    What the design does
    Accept it. At a rate near 1%, a few pages are missed and the filter stays small.

6. Deep dives

Politeness & URL Frontier Design
The URL frontier splits incoming URLs into Priority Queues (based on PageRank) and Politeness Queues (one FIFO queue per target hostname). A router worker ensures each host queue is accessed at most once per politeness interval using a delay queue.

7. Follow-up questions

  • How do you detect spider traps? (Answer: Limit URL path depth, enforce per-domain maximum page limits, and analyze URL query parameter patterns).

What it costs

Storage dominates: about 500 TB of pages a month. Network traffic comes second. Compress pages, keep only the text you index, and move old copies to a cheaper storage class.

Another way to design it

If you only need a known list of sites, a simple queue with a politeness delay per site is enough. The priority queues and the Bloom filter earn their place only at web scale.

8. How answers are judged

A passing answer at Mid level. A complete design with numbers: about 400 pages a second on average, 1,000 at peak. It explains how already-seen URLs are skipped and goes deep on one part, such as storage or politeness.

How each level is judged
What is judgedJuniorMidSeniorStaff
BreadthHow much of the system does the answer cover?Names the core parts: clients, servers, a database and a cache.Covers the whole main flow, from the request to the stored data and back.Builds a complete design without being led through it.Covers the system, the systems around it and who owns each part.
DepthHow far does it go into the hard parts?Explains what each part does and why it is there.Goes deep on one part, such as the database or the cache.Goes deep on the two or three riskiest parts.Goes deepest where the risk is largest, and explains why the risk is there.
DrivingWho leads the conversation?Follows the interviewer, step by step.Moves forward alone, with an occasional nudge.Leads the conversation from start to finish.Changes the problem when the question asked is not the right one.
Trade-offsAre choices compared and justified?Names more than one option.Says why one option was picked over another.Compares options in detail, with what each one costs.Ties each choice to cost, speed and risk for the business.
Unclear questionsWhat happens when the question is vague?Answers the questions that are asked.Asks questions to make the problem clear.Sets the scope and says what is left out.Questions the assumptions behind the problem itself.
ScopeWhat does it consider beyond the normal path?Covers the normal path, when everything works.Adds what happens when a part fails.Adds growth: what breaks at ten times the load, and the fix.Adds abuse, cost and the daily work of running the system.

Requirements and scope

Strong answer
Before I design, I want to check the scope. We crawl from seed URLs, extract links, and store raw pages; robots.txt and politeness limits are a hard requirement, not optional. I will assume we need to reach 1 billion pages a month, and that duplicate URLs must not be fetched twice.
Weak answer
The crawler starts from a few seed pages, downloads each one, finds the links inside, and adds those links to the queue to fetch next.

Shows: Unclear questionsThe difference: The weak answer never asks about politeness limits, which the problem states as a hard requirement, so it could fetch a site far too fast.

Estimates

Strong answer
1 billion pages a month is about 400 pages a second on average, and 1,000 at peak. At 500 KB a page, that is about 500 TB a month, or 6 petabytes a year. That rules out keeping raw pages on a single disk.
Weak answer
1 billion URLs a month is a lot of links to track. But links are short pieces of text, so storage will not be a real concern.

Shows: DepthThe difference: The weak answer sizes storage for the URLs, not the roughly 500 KB of downloaded content behind each one. That content comes to about 6 petabytes a year.

Core design

Strong answer
A worker fetches a URL, saves the page to blob storage, and extracts its links. Each new link is checked against a Bloom filter of already-seen URLs before joining the queue, so the same page is never queued twice.
Weak answer
Each worker fetches a URL, saves the page to blob storage, and pushes every link it extracts onto the frontier. The frontier keeps one queue per host and waits between requests to the same host.

Shows: DepthThe difference: With no way to check whether a URL was already fetched, the crawler can queue and refetch the same pages. It can even loop forever on a link cycle.

Deep dive

Strong answer
The hard part is not overwhelming one site: workers pulling from one shared queue can all land on the same host at once. I would split the queue per host. A delay queue then releases a host's next URL only after a politeness interval, such as 2 seconds.
Weak answer
I would have a large pool of workers pull from one shared queue of URLs and fetch pages as fast as the pool allows.

Shows: DepthThe difference: A shared queue lets many workers fetch from the same host at once, slamming it with concurrent requests. Per-host queues with a delay enforce politeness instead.

Failures and trade-offs

Strong answer
A page that generates endless new links, such as an infinite calendar, can fill the frontier with junk forever. I would cap the pages crawled per domain and the URL path depth. That way, one such site cannot starve the crawl budget for every other domain.
Weak answer
If a site keeps producing new links, the crawler keeps discovering and fetching them, since more pages found means more of the web gets covered.

Shows: ScopeThe difference: With no per-domain limit, one site that generates endless links can consume the entire crawl budget, starving every other domain.

We wrote this guide in our own words, informed by public interview guides such as AlgoMaster and Hello Interview. We are not connected to either site. Interviewers differ. The guide and the example answers show the direction each level takes, not a checklist.

10. Check your design with your own AI

Write your design first. Then copy this prompt into the AI chat you already use, and add your design at the end. It asks for a score in each area, one fix for each, and two follow-up questions.

The site sends nothing anywhere. An AI review can be wrong, so check what it says against sections 8 and 9.

See the prompt
You are a system design interviewer. Review my design for the interview problem below.

Problem: Design a Distributed Web Crawler
Design a scalable web crawler to download and index billions of web pages across the internet.

What users must be able to do:
- Crawl web pages starting from seed URLs.
- Extract HTML, extract outbound links, and store raw content in blob storage.
- Respect robots.txt and website politeness policies.

How well it must work:
- Scalability: 1 Billion pages per month.
- Be polite: never send so many requests at once that a website slows down.
- Extensibility: Support pluggable document parsers.

Numbers to assume:
- 1 Billion pages crawled per month = ~400 pages/sec continuous download.

Judge my design at the Mid level.
A passing answer at this level: A complete design with numbers: about 400 pages a second on average, 1,000 at peak. It explains how already-seen URLs are skipped and goes deep on one part, such as storage or politeness.

For each area below, say whether my design is strong, fine or weak. Give one reason and one fix for each:
1. Requirements and scope
2. Estimates
3. Core design
4. Deep dive
5. Failures and trade-offs

Then ask me the two follow-up questions an interviewer would ask next.
Do not write a full model answer for me.

My design:
[Describe your parts, how one request moves through them, and why you chose each one.]