Skip to content

When a request fails, the most natural reaction in code is to try again. One extra attempt is usually harmless. The trouble starts when "try again" has no ceiling: the loop keeps going until something works, every failure in a batch triggers its own chain of attempts, and nobody notices because the job still finishes. Then the usage report arrives and the number is several times larger than the amount of data you actually collected.

This article explains how that multiplication happens when you work through a proxy, how to see it in your own numbers, and how to put sensible limits around retries. It assumes lawful use: you collect data you are allowed to collect, you respect the terms and robots rules of the sites you visit, and you follow the law where you and your targets are located. Nothing here is about getting around restrictions. It is about not wasting traffic on attempts that were never going to succeed.

Why a retry is never "just one more request"

A request through a proxy costs something every time it runs. Depending on how a plan is metered, that cost may be counted as traffic in bytes, as a number of requests, as time on a session, or as some combination. Check the plan page for what is metered in your case. Whatever the metric, a retry spends it again.

There are three reasons a retry is more expensive than it looks:

  1. It repeats the whole exchange. Headers, TLS setup, the response body or a partial body, and any redirects all happen again. A page that failed after 80 percent of the body arrived still cost most of a full download, and the retry pays for the whole thing once more.
  2. It often goes through a more expensive path. If your setup falls back to a different route, a different exit address or a fresh connection on failure, the retry may need a new handshake as well.
  3. It is correlated with other failures. Failures rarely arrive one at a time. A slow target, a network blip or a rule on the target side makes many requests fail together, and each of them starts its own retries at the same moment.

So the cost of a failure is not one extra request. It is the number of attempts you allow, multiplied by how many items fail at once.

The multiplication in a plain example

Imagine a collector that visits 1,000 product pages once a day. On a clean day, it makes 1,000 requests. Now suppose the target slows down and 30 percent of requests time out. The code is written as "retry until it works, up to five times, with no delay".

  • First pass: 1,000 requests, 300 fail.
  • Second pass: 300 retried, and because the target is still struggling, most fail again, say 200.
  • Third to sixth passes: the remaining failures keep retrying at full speed.

The total is easily 1,800 to 2,200 requests for the same 1,000 pages, and the retries all happen while the target is already overloaded, which makes more of them fail. These numbers are only an illustration, but the pattern is real: the traffic is highest exactly when the results are worst.

Nested retries are worse. If your HTTP client retries three times, and your job runner retries the whole task three times, one bad page can produce nine attempts. Add a third layer, such as a queue that re-delivers failed messages, and the product grows again. Many teams only discover the layers when they read the logs line by line.

Which failures deserve a retry

Not every failure is temporary. A useful retry policy starts by sorting errors into groups.

Kind of failure Typical signal Retry?
Network timeout or connection reset No response, or the connection drops Yes, a limited number of times with a delay
Temporary server error HTTP 502, 503 or 504 Yes, with backoff, and honour any Retry-After header
Too many requests HTTP 429 Slow down first; retry only after the indicated wait
Forbidden or unauthorised HTTP 401 or 403 No. Retrying will not change the answer; review your access and the site's rules
Not found or gone HTTP 404 or 410 No. Record it and move on
Client error from a bad request Other HTTP 4xx No. Fix the request
Parse failure on a valid 200 Page loads but your extractor fails No network retry. Fix the parser or store the page for review

The semantics of these codes are defined in RFC 9110. A 429 or a 403 is the target telling you something. Hammering it with immediate retries does not make the message go away, and it burns traffic while you ignore it. If you see these responses often, the answer is a lower request rate and a review of whether the collection is permitted, not a longer retry loop.

Build a retry policy with a ceiling

A sound policy has four parts, and each one limits cost.

A maximum number of attempts per item. Two or three attempts in total is a reasonable starting point for most jobs. Make it a named setting rather than a number buried in the code, so you can see it in review.

Exponential backoff with jitter. Wait longer after each failure, and add a random offset so that a thousand failed requests do not all retry in the same second. A simple pattern is a base delay that doubles each time, capped at a maximum, plus a small random amount. Backoff reduces cost twice: it gives a struggling target time to recover, and it spreads load so fewer retries fail.

A retry budget for the whole job. Per-item limits are not enough if everything fails at once. Set a ceiling such as "retries may add at most a fixed fraction on top of the first-pass requests". When the budget is spent, the job stops retrying and reports what is left. This is the single most effective guard against a runaway bill.

A circuit breaker. If the failure ratio over the last few minutes crosses a threshold you chose, pause the job for a while instead of continuing to send requests that are likely to fail. Resume with a small probe request, and only continue at full pace when the probe succeeds.

Here is a plain-language version of the policy you can adapt:

  1. Try the request once.
  2. If the error is in the "retry" group, wait a short delay with jitter and try again.
  3. After the second failed retry, mark the item as failed and put it in a list for the next scheduled run.
  4. If the share of failures in the current window passes your threshold, stop the job and send an alert.

Retry only what is safe to repeat

Some requests change state on the other side. Repeating a GET that reads a public page is safe. Repeating a POST that submits a form or places an order is not, unless the service is designed for it. Even for reads, check whether the site asks for a particular crawl pace in its robots file, described in RFC 9309, and keep your retry traffic inside those expectations. Retries are still requests, and they count against any limit the site has set.

Measure attempts, not only results

You cannot control what you do not measure. Most scraping dashboards show items collected and items failed. For cost control you also need:

  • Attempts per item, as an average and as a distribution. A healthy job has an average close to one; an average of three means two thirds of your traffic is repeat work.
  • Bytes per collected item, including failed attempts. Compare it with the size of a single clean page.
  • Failure reasons, grouped by the table above, so you know whether you are fighting timeouts or access rules.
  • Retry share over time, so a sudden jump after a code change or a target change stands out.

A very small test before a large run helps here. Send a few hundred requests, read the numbers, and extrapolate carefully before you commit a full day of collection. The guide on what to test before buying a research proxy covers the checks that make these numbers meaningful, and planning traffic for a daily price tracker shows how to turn them into a realistic budget.

Reduce the need to retry at all

The best retry is the one you never make, so work on the causes of failure as well as the response to them.

  • Cache what does not change. If you fetch the same page twice in the same run, the second fetch is waste whether it succeeds or not. See reducing duplicate requests with caching for patterns that remove repeat work.
  • Lower concurrency. Many timeouts are self-inflicted: too many parallel connections overload either the target or your own machine. A smaller worker pool often finishes sooner because fewer requests fail.
  • Set realistic timeouts. A timeout that is too short turns slow but valid responses into failures that then have to be repeated. One that is too long ties up workers. Measure typical response time and set the limit a comfortable margin above it.
  • Check your proxy configuration. A wrong port, a wrong protocol or a missing authentication detail produces failures that no number of retries will fix. The MDN overview of proxy servers and tunneling is a good refresher on how requests travel through a proxy.
  • Collect less often. If a page changes once a day, fetching it every hour multiplies traffic without adding information.

Limits and what to watch for

Capping retries is a trade-off, and it helps to be honest about it.

  • A tight ceiling means some items will be missing on a bad day. Plan for a catch-up run rather than raising the ceiling.
  • Backoff makes jobs take longer. Schedule collection windows with that in mind.
  • A circuit breaker can pause a job that would have recovered on its own. Tune the threshold using your own history, and review pauses afterwards.
  • A bigger pool of addresses is not a replacement for a good policy. If the cause is your request pattern or the target's rules, more addresses only spread the same behaviour wider and raise the bill faster.
  • Metering differs between plans and products. Read the plan page to see what is counted, and do not assume that failed requests are excluded from metering or that retries are exempt.

Above all, treat repeated 403 or 429 responses as a signal to stop and review, not as a puzzle to defeat. Respecting a target's limits is both the lawful approach and the economical one.

Summary

Unbounded retries turn a small failure into a large bill because every attempt repeats the full exchange, failures arrive in clusters, and several layers of retry multiply each other. Sort errors into those worth repeating and those that are not, cap attempts per item, add exponential backoff with jitter, set a retry budget for the whole job, and use a circuit breaker for bad periods. Measure attempts per item and bytes per collected item so you can see the problem before the invoice shows it, and remove avoidable work with caching and sensible concurrency. If you are planning a collection job through a proxy, you can look at the options on the proxy page and check what is metered before you size your retry policy.

Frequently asked questions

Why do retries raise proxy cost so quickly?

Every retry is a new request that sends and receives data again. If a job retries each failure several times, the traffic and request count for that job is a multiple of what a clean run would use, and failures often arrive in clusters.

Should I never retry a failed request?

No. Retrying a temporary failure is normal and useful. The problem is retrying without a ceiling, without a delay, or for errors that will not change on the next attempt.

Which errors are worth retrying?

Usually network timeouts, connection resets and temporary server errors. Responses that say the request is not allowed, the page does not exist, or the client is sending too much should not be retried blindly.

How can I measure the damage retries are doing?

Log attempts per item, not just final results. Compare total requests and bytes against the number of items you actually collected, and watch that ratio over time.

Is a bigger proxy pool the fix for failures?

Not by itself. If the failure comes from your request pattern or target rules, more addresses only let the same mistake run in more places. Fix the pattern first.

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

How to Reduce Duplicate Requests in Data Collection with Caching

Fetching the same page twice wastes traffic and loads the target site. Learn URL normalization, a local cache, TTLs and conditional requests.

10 min read

Proxy Guides

What to Test Before Buying a Proxy for Research

Before you build a research workflow on a proxy, run a short set of tests. This checklist covers what to check, how to read the results, and what a test cannot tell you.

9 min read

Proxy Guides

How to Plan Traffic for a Daily Price Tracker

A price tracker is only as predictable as its traffic. Learn to estimate page weight, daily requests, retries and headroom, and to trim transfer where you can.

9 min read