Skip to content

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 readUpdated Nov 14, 2026By XPASS Editorial Team

How to Reduce Duplicate Requests in Data Collection with Caching

The best request is the one you never send. In data collection projects, a surprising share of traffic is spent fetching content that you already have, from URLs that look different but lead to the same page, or from pages that have not changed since yesterday. Each of those requests costs transfer, adds time and puts load on a site that did nothing to deserve it.

Caching and deduplication are the main tools for avoiding that waste. This guide explains where duplicates come from, how to remove them step by step, how HTTP conditional requests work and how to keep your cached data fresh. It assumes lawful collection of public pages, following each site's terms, its robots rules and local law.

Where duplicate requests come from

Before building anything, it helps to know what you are removing. Most duplicates fall into these groups.

  1. The same URL written differently. A trailing slash, upper-case letters in the host, a tracking parameter or reordered query parameters can make one page look like several URLs.
  2. The same page reached by several paths. A product listed in three categories may have three category URLs that all lead to one product page.
  3. Overlapping pagination. If new items are added while you page through a list, the last item of one page can appear again at the top of the next.
  4. Repeated work inside a run. A queue may receive the same URL from several sources, or a restart after a crash may re-process what was already done.
  5. Retries that did succeed. A timeout on the way back can make a client retry a request the server had already answered.
  6. Unchanged pages fetched on a schedule. A page that updates weekly does not need a daily fetch.
  7. Multiple jobs doing the same thing. Two scripts or two team members may fetch the same page for different reasons.

Each group has its own remedy. The sections below follow them in order, from the simplest fix to the most involved.

Step 1: Normalize URLs

Normalization turns different spellings of the same address into one canonical form. Do it before anything enters your queue or cache.

  • Lower-case the scheme and host. Leave the path as is unless you know the site treats it case-insensitively.
  • Remove the fragment (the part after #), because it is never sent to the server.
  • Remove default ports such as :443 for HTTPS.
  • Strip known tracking parameters that do not change the content, such as campaign tags. Be careful: keep any parameter that selects the product, language, currency or page number.
  • Sort the remaining query parameters alphabetically so that the order never creates a new key.
  • Decide on one rule for trailing slashes and apply it consistently.
  • Follow the page's canonical link if it provides one and you are sure it points to the same content.

Test normalization on a sample of a few hundred real URLs and compare the count before and after. A drop of ten or twenty percent is common for sites with heavy tracking parameters.

Step 2: Deduplicate inside a run

Within a single run, keep a set of normalized URLs you have already queued or fetched. Before adding a new URL, check the set. This is a very small piece of code with a large effect.

Practical points:

  • Keep the set in memory for small jobs and in a database table for larger ones, so a restart does not lose it.
  • Record the state of each URL: queued, fetched, failed, skipped. The state tells you whether a retry is justified.
  • Use the stable product identifier as an additional key where the site provides one. Two different URLs with the same product identifier can then be recognised as one.
  • Make job restarts idempotent: on restart, skip anything already marked fetched in this run.

The guide on planning traffic for a daily price tracker shows how every extra fetch multiplies into the monthly total, which is why this simple step pays off.

Step 3: Add a local cache

A cache stores the response, or the data you extracted from it, so that a later request can be answered locally. You have two choices, and many projects use both.

Cache level What you store Good for Watch out for
Raw response cache The body and key headers of each response Re-parsing without re-fetching, debugging layout changes Storage use, and old responses piling up
Extracted record cache The parsed fields plus fetch time Skipping pages that cannot have changed yet Parser changes that require old pages to be re-read

A simple cache key is the normalized URL plus any request detail that changes the content, such as language or exit region. If a site returns different prices by region, the region must be part of the key or the cache will mix markets.

Store at least the following with each entry: the key, the fetch time, the status code, the validators (ETag and Last-Modified if present) and a content hash. Those five items support almost every strategy below.

Step 4: Set time-to-live by how fast data changes

A time-to-live (TTL) is how long a cached entry counts as fresh. Choose it from measurements, not habit.

  1. Take a sample of 50 to 100 pages and fetch them daily for two weeks.
  2. For each page, note how often the extracted values changed.
  3. Group the pages into fast, medium and slow movers.
  4. Assign TTLs, for example less than a day for fast movers, a few days for medium ones and a week or more for slow ones.
  5. Review the groups every month, because a page that was stable may become active during a sale.

Also consider an event-based refresh: force a re-fetch of pages that matter most around known events, such as a campaign start, even if the TTL has not expired.

A cache that never expires gives you stale data; a cache that expires too soon saves nothing. The right setting lies between, and data from your own pages will tell you where.

Step 5: Use HTTP conditional requests where supported

HTTP has a built-in way to avoid downloading unchanged content. RFC 9110 defines it.

  1. When you first fetch a page, the server may include an ETag (an opaque identifier of the version) and a Last-Modified date.
  2. On the next fetch, you send If-None-Match with the stored ETag, or If-Modified-Since with the stored date.
  3. If the content is unchanged, the server answers 304 Not Modified with no body. You keep using your cached copy and transfer only the headers.
  4. If it changed, the server sends a normal 200 response with the new body and new validators.

Points to remember:

  • Not every site supports it. Many dynamic pages send no useful validators, or send validators that change on every request. Test a few pages and see how often you really get a 304.
  • A 304 still counts as a request. It is tiny compared with a full page, but it is still a request, so it counts toward request-based limits and still places a small load on the site.
  • Respect cache headers. If a response says how long it may be reused, as with Cache-Control, treat that as a hint about how often the content is expected to change.
  • Do not guess validators. Send only values the server gave you.

Step 6: Skip unchanged content with a hash

Even when a site does not support conditional requests, you can avoid unnecessary work after fetching. Compute a hash of the part of the page that carries your data, such as the price block, and compare it with the stored hash. If they match, skip parsing and writing. This does not save transfer, but it saves processing and keeps your history clean of meaningless "updated" rows.

For transfer savings, combine the hash with the TTL approach: a page whose hash has not changed for many runs earns a longer interval.

A worked example

You track 400 product pages for a small study, fetching each daily. Your first measurement shows the following:

  • 60 URLs are duplicates caused by tracking parameters and category paths.
  • About 150 products change price less than once a week.
  • The site supports ETag on product pages and returns 304 when nothing has changed.

You apply the steps:

  1. Normalization and product identifiers reduce 400 URLs to 340 unique pages.
  2. A run-level set prevents the occasional double fetch after a restart.
  3. A TTL of three days is set for the slow group of about 130 pages (the share of the 340 that are slow movers), so they are fetched about once every three days instead of daily.
  4. The remaining 210 pages use conditional requests. On days when most are unchanged, they cost only headers.

Daily requests fall from 400 to about 253 (roughly 43 slow-group fetches plus 210 conditional ones), and on quiet days most of those 210 return only headers. The saving carries into the monthly total you estimated in the traffic plan. Your results still need checking: the quality checks in the guide on data quality for web scraping help confirm that skipping pages did not hide real price changes.

Retries, duplicates and cost

Retries are a special case of duplicates because they are intentional. A retry is justified only when the first attempt failed for a reason that might pass, such as a timeout or a temporary 503. A retry on a permanent error, or retries with no cap, create exactly the kind of repeated traffic that this guide aims to remove. The article on why retries without a cap inflate proxy cost explains how this multiplies usage, and caching helps because a successful earlier fetch means no retry is needed.

Combine both: before retrying, check the cache for a recent valid copy, and before every fetch, ask whether the data could have changed since the last one.

Limits and what to watch for

  • Caching can hide changes. Long TTLs mean you may report old prices. Record the fetch time and show it in your reports.
  • Region and session matter. Different exit regions can return different content, so include them in cache keys. A cached page fetched in one region must not answer a request for another.
  • Do not cache what you should not keep. Avoid storing personal data. Keep only what the study needs, and follow the retention rules that apply to you.
  • Storage grows. Raw response caches can become large. Set a clean-up rule for old entries.
  • Respect the site. A cache reduces load, which is good, but it is not a licence to speed up elsewhere. Keep the pace modest and follow the robots rules in RFC 9309.
  • Proxy behaviour is separate. A proxy relays traffic; the MDN article on proxy servers and tunneling explains the basics. Any caching a proxy might do is not something to rely on, so build your own cache and key it carefully. For choosing connections for a small project, see the guide on choosing a proxy for a small market research project.

Summary

Duplicate requests come from differently written URLs, several paths to one page, overlapping pagination, restarts, successful-but-retried requests and pages fetched more often than they change. Remove them in order: normalize URLs, deduplicate inside each run, add a local cache keyed by URL and region, choose time-to-live values from measured change rates, use ETag and Last-Modified conditional requests where the site supports them and compare content hashes to skip needless processing. Keep fetch times in your data, put limits on retries and review the numbers each month. When you are ready to pick connections for your project, the proxy page lists what is available.

Frequently asked questions

What counts as a duplicate request in data collection?

Any request that fetches content you already have and that has not changed. Typical sources are the same URL written in different ways, pages reached through several category paths, repeated retries that succeeded and re-fetching inside one run.

What is a conditional request?

It is a request that includes a validator from an earlier response, such as an ETag or a Last-Modified date. If the content has not changed, the server can answer 304 Not Modified without sending the body, which saves transfer. It only works where the site supports it.

How long should I keep a page in my cache?

Match the time-to-live to how fast the data really changes. Prices that change daily need a TTL of less than a day, while descriptions that change monthly can be kept much longer. Measure change rates on a sample before choosing.

Can caching make my data stale?

Yes, if the time-to-live is too long or you never refresh. Store the fetch time with each cached record, set sensible expiry rules and force a refresh for pages where freshness matters most.

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 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

Proxy Guides

Why Unbounded Retries Make Your Proxy Bill Climb

A retry loop with no ceiling quietly multiplies the traffic you use. See how the multiplication happens and how to put sensible limits around it.

9 min read

Proxy Guides

How to Choose a Proxy for a Small Market Research Project

Small research projects do not need a large setup. Define your scope, compare proxy types, run a short pilot and decide from your own measurements.

10 min read