Skip to content

Designing Rate Limits So a Web Scraper Respects the Target Site

A respectful scraper limits itself before the site has to. Learn how to build per-host pacing, honour robots.txt and react correctly to 429 responses.

10 min readUpdated Nov 14, 2026By XPASS Editorial Team

Designing Rate Limits So a Web Scraper Respects the Target Site

A web scraper is a program that visits pages on its own. That can be entirely reasonable: monitoring your own site from outside, collecting public data that the owner allows to be collected, checking prices you are authorised to check, or testing how a page appears from another network location. But every automated request costs the site something, and a scraper that sends too many requests too fast can slow the site for real visitors, trigger blocks and damage your own work.

A respectful scraper therefore limits itself before the site has to. This guide explains how to design that self-limit: what to measure, how to pace requests per host, how to read robots.txt and rate limit signals, and how to behave when a site asks you to slow down. Everything here assumes lawful use that respects the target site's terms and local law. Pacing is not a trick for getting around controls. If a site does not want automated access, the right answer is to stop and ask for permission or use an official API.

What a rate limit is and who sets it

A rate limit is a cap on how many requests are allowed in a period of time. Two parties can set one. The site or its infrastructure may enforce a limit and answer with a refusal when it is exceeded. And you, the operator of a scraper, should set your own limit so that you stay well below anything the site would have to enforce.

The two are different in spirit. A limit enforced by the site is a reaction to harm that has already started. A limit you set yourself is prevention. If you can see from the site's behaviour that it tolerates only a certain pace, then your own pace should sit comfortably under it, not right at the edge.

Limits come in several shapes. A fixed window counts requests in a block of time, such as sixty seconds. A sliding window counts over the last sixty seconds at any moment. A token bucket lets bursts happen up to a small size while keeping the long-run average low. A concurrency limit caps how many requests are in flight at once. For a scraper, the most useful combination is a low average rate with a small concurrency, because that is the gentlest on a server.

Start with permission and the site's own signals

Before you write any pacing code, check what the site says about automated access.

  1. Read the terms of service. If they forbid automated access, do not scrape. Ask for permission or use an official API or data feed.
  2. Read robots.txt. RFC 9309 describes the Robots Exclusion Protocol: a file at the root of the host that lists which paths crawlers should avoid, and sometimes extra hints. It is a statement of the owner's preferences and a widely respected convention, not a legal permission by itself, and it does not replace the terms of service.
  3. Look for official interfaces. A documented API usually states its own limits, and using it is more reliable than parsing pages.
  4. Look at the response headers. Some sites send headers that describe limits or remaining quota, with names that vary between services. The guide on inspecting response headers through a proxy shows how to capture them. Treat any such header as authoritative for that site.

Note that the Crawl-delay directive found in some robots.txt files is not part of the core standard, and not every crawler honours it. If a site publishes one, it is still a useful hint about the pace the owner prefers, and following it costs you little.

Designing the pacing rules

A practical design has a few layers. Each one is simple, but together they make the scraper predictable.

Layer What it controls Why it helps
Per-host rate Requests per second or minute to each hostname The main protection for each site
Per-host concurrency Requests in flight to a host at one time Avoids bursts and open-connection pressure
Global rate Total requests across all hosts Protects your own bandwidth and workers
Minimum delay Gap between consecutive requests to one host Keeps spacing even instead of clumped
Jitter Small random variation in the delay Avoids a robotic, perfectly regular pattern and synchronised bursts
Daily or job cap Maximum requests per run or per day Prevents runaway jobs

A good starting point for a single site is one request in flight at a time, with a delay of a second or more between requests, plus a little jitter. Increase the pace only if the site is clearly comfortable with it, for example because an official document says so, and only in small steps. If you are unsure, go slower. A scraper that finishes later but never bothers anyone is better than one that finishes sooner and gets blocked.

Treat each host separately. A shared queue that sends many requests to one site while other hosts sit idle is a common mistake. Use a queue per host, with a scheduler that picks the next host whose delay has passed. This also lets you run many different sites in parallel while each one sees only a gentle trickle.

Identify yourself honestly. Send a descriptive User-Agent that names your tool and gives a way to contact you, such as a page or an email address that you monitor. Site owners are far more willing to tolerate a scraper they can reach than an anonymous one.

Reading the site's feedback

A well-designed scraper listens. The HTTP specification, RFC 9110, defines the status codes and headers that carry feedback.

  • 429 Too Many Requests means you are sending too much. Stop for the period in the Retry-After header if present, otherwise back off with a growing delay, and then resume at a lower rate than before.
  • 503 Service Unavailable may mean the site is overloaded. It can also carry Retry-After. Treat it as a signal to slow down, not just to retry.
  • 403 Forbidden or a block page means the site does not want you there, at least at this moment. Do not try to get around it. Stop, review whether you have permission, and contact the owner if the work is legitimate.
  • Rising response times are an early warning. If the average time to first byte climbs while you scrape, reduce your pace even before any error appears.
  • Retry-After can contain either a number of seconds or a date. Handle both forms.

Build the reaction into the scraper itself. A common approach is adaptive pacing: when responses are fast and healthy, hold the pace steady; when you see 429, 503 or slowing responses, cut the rate by half and raise it back only gradually after a quiet period. This resembles the way network protocols respond to congestion, and it keeps you from needlessly pressing a site that is struggling.

The wait times after failures should follow the same principles as any retry design. The article on choosing timeouts and a retry budget for a proxy API explains backoff with jitter and a firm cap on attempts, which fit neatly under the pacing rules described here.

A worked example

Suppose you operate a price comparison tool and you have written permission from a retailer to check two hundred product pages every night. You want a gentle design.

  • Host: one hostname, so one queue.
  • Concurrency: one request at a time.
  • Delay: a minimum of two seconds between requests plus up to one second of random jitter. Two hundred pages then take roughly ten minutes, which is perfectly fine for a nightly job.
  • Schedule: run at an off-peak hour for the retailer's main audience, not at a time when traffic is highest.
  • Caching: store the ETag or Last-Modified value from each response and send a conditional request next time. If the page has not changed, the server can answer with a short 304 response, which is lighter for both sides.
  • Feedback: if a 429 or 503 appears, pause the queue for the Retry-After value or a growing delay, resume at half the previous pace, and write the event to the log.
  • Cap: stop the job after a fixed number of requests, even if the list is longer, and report the rest as not checked.

Notice that nothing in this design needs speed. The aim is steady, polite, repeatable behaviour. If the job later needs to run faster, you ask the retailer and agree on a higher limit, rather than quietly increasing the pace.

Rate limits when you use a proxy

A proxy forwards your requests through a different network path. The MDN guide on proxy servers and tunneling describes how that works in general. It changes where the site sees the request coming from. It does not change how much load the request creates.

This has an important consequence. Spreading requests over many routes in order to exceed the limit a single route would face is not respectful pacing. It is an attempt to get around the site's controls, and it is the kind of behaviour that rightly gets traffic blocked and may breach the site's terms. Your limits should be defined per target site, not per route. If you use several routes for a legitimate reason, such as checking how a page appears in different locations, keep the total pace toward each site gentle.

In practice, count the requests per hostname in one shared place, regardless of which route carried them. A shared limiter, for example one backed by a small in-memory store or a database counter when you run several workers, keeps the sum under your chosen cap.

Limits and what to watch for

Even a careful design has weak points.

  • Clock and scheduling drift can cluster requests. Use a scheduler that enforces a minimum gap, not just an average rate.
  • Several workers can multiply the pace by accident. If you run ten processes each with its own limiter, the site sees ten times the rate. Share the limiter or divide the budget.
  • Retries add load. A retry is another request. Count it against the rate, not outside it.
  • Caching and conditional requests reduce load but do not remove the need for pacing. A page that has changed still costs a full response.
  • Redirects count too. A request that follows three redirects generates four requests. Include them in the rate.
  • Large assets are heavier than HTML. If you fetch images or scripts, they use bandwidth. Fetch only what you need.
  • Sites differ. A small personal site can be overwhelmed by a pace that a large service would not even notice. Err on the side of slower, and look for official guidance.
  • Your logs matter. They help you prove that you stayed within your own limits, but they should not contain secrets or personal data. The article on logging from a proxy without exposing user data covers how to keep useful records safely.
  • A rate limit is not a legal shield. Staying slow does not make scraping permitted if the terms or the law say otherwise.

A checklist for a respectful scraper

  1. Confirm that you have permission or that the terms allow the access you plan.
  2. Read and follow robots.txt, and use an official API where there is one.
  3. Set a per-host rate, a per-host concurrency of one by default, a minimum delay and jitter.
  4. Send an honest User-Agent with a contact route.
  5. React to 429, 503 and rising latency by slowing down, and honour Retry-After.
  6. Use conditional requests and caching to avoid repeated downloads.
  7. Count retries and redirects in the rate, and share the limiter across workers.
  8. Cap each job, log your behaviour without secrets, and review the numbers regularly.

Summary

A respectful scraper limits itself before the site has to. Start from permission, the terms and robots.txt, then pace requests per host with a low rate, small concurrency, a minimum delay and a little jitter. Listen to the site's feedback, treat 429 and 503 as instructions to slow down, and recover gradually. A proxy changes the network path but never the load, so the same gentle limits apply, and spreading traffic across routes to exceed what a site allows is not acceptable. Count retries and redirects, share limiters between workers, and keep logs without secrets. When you are ready to run lawful, well-paced traffic of your own, the Proxy page explains what is available and how to get started.

Frequently asked questions

What is a rate limit in the context of a scraper?

It is a rule that caps how many requests your scraper sends to a site in a given time. A respectful scraper applies its own limit so that the site never has to enforce one against it.

Should the limit be global or per host?

Both. A global limit protects your own system, while a per-host limit protects each target site. The per-host limit is the one that matters most for politeness.

What should a scraper do when it receives a 429 response?

Stop sending requests to that host for the time given in the Retry-After header, or for a growing delay if no header is present, and then continue at a slower pace. It should not try to avoid the limit.

Does using a proxy change how much I should send?

No. A proxy changes the network path, not the load on the site. The same polite pacing applies, and spreading requests across routes to exceed what a site allows is not acceptable.

Is robots.txt a legal permission?

No. It is a standard way for site owners to state crawling preferences, described in RFC 9309. Following it is good practice, but you must also respect the site terms and local law.

About the author

Bob Kanokphon Thongdee, founder of XPASS VPN

Bob Kanokphon Thongdee

  • Founder of XPASS VPN
  • Co-founder of eSIMonline.asia
  • More than 7 years in online marketing
  • Founder of Cojourney Visa and Cojourney Travel

Need a proxy for this?

XPASS Proxy sells residential proxy traffic by the gigabyte, with the price shown before you pay.

See proxy plans

Keep reading

Proxy Guides

Choosing Timeouts and a Retry Budget for a Proxy API

Good timeouts and a firm retry budget keep proxy-based jobs predictable. Learn how to choose values, back off politely and stop in time.

10 min read

Proxy Guides

How to Log Proxy Traffic Without Exposing User Data

Logs help you debug proxy jobs, but they can leak passwords, tokens and personal data. Learn what to keep, what to mask and how long to store it.

10 min read

Proxy Guides

How to Inspect Response Headers Through a Proxy

Response headers explain caching, redirects, language and errors. This guide shows how to capture them through a proxy and read them correctly.

9 min read