How Much Proxy Traffic Does a Scraper Use? Measuring and Cutting GB Usage on a VPS

How Much Proxy Traffic Does a Scraper Use? Measuring and Cutting GB Usage on a VPS

  1. Home
  2. Blogs
  3. How Much Proxy Traffic Does a Scraper Use? Measuring and Cutting GB Usage on a VPS

Residential proxy plans are sold by the gigabyte, and the bill depends on more than the number of pages you collect. Rotation mode, connection reuse, retries and whether you re-download unchanged pages can change monthly traffic by a factor of three or more. This walkthrough sets up a small price monitor on a Linux VPS with AProxy residential proxies in Node.js, measures what each request really costs in bytes, and turns that into a bandwidth estimate you can check against the dashboard.

Why a VPS: it keeps the job running when your own computer is off, and its datacenter connection is stable. It raises availability but cannot guarantee it — servers restart and networks hiccup — so the script saves its state after every run and simply continues on the next one.

1. The setup at a glance

  • VPS: for an HTTP-based monitor like this one, 1 vCPU and 1–2 GB RAM is enough to start; browser-based scraping needs much more. PSB Hosting VPS plans start from 1 vCPU / 2 GB; Hi-CPU VPS on Ryzen 9 7950X suit heavier parsing.

  • Proxy: AProxy rotating residential proxies (HTTP/SOCKS5, country/state/city targeting, rotating or sticky sessions). AProxy also offers unlimited residential, long-acting ISP, static residential and static datacenter proxies; the bandwidth logic below matters most for per-GB plans.

  • Code: Node.js 20+ with undici, plain HTTP requests, no browser.

  • Rules: only collect pages you are allowed to collect, and keep the request rate modest. AProxy does not support some policy-restricted site categories (for example, financial, government and payment platforms).

2. Get the connection details

In the AProxy dashboard open Get Proxy, choose the package type Residential Proxy, then set the sub-account, country, state/city, region and session duration, and click Generate → Copy.

AProxy dashboard: Get Proxy — package type, location and session parameters

AProxy's documentation describes the connection format like this:

Gateways (port 2312):  gw-us.aproxy.com  (Americas)
                       gw-eu.aproxy.com  (Europe)
                       gw-as.aproxy.com  (Asia)

Rotating, any country:  USERNAME:[email protected]:2312
Rotating, US exit:      USERNAME_area-US:[email protected]:2312
Sticky, 5 minutes:      USERNAME_area-US_session-HkpQcVhdYc_life-5:[email protected]:2312

session and life are used together: the session ID (4–12 letters or digits) pins the session, and life is the sticky time in minutes. Requests with the same session ID get the same exit IP "as much as possible" — if the residential device goes offline, the IP changes earlier. Pick the gateway closest to your VPS, and the exit country with area.

A useful habit: create a sub-account (left menu → Sub-account → Add Sub-accounts) for each project and set a traffic limit on it. Usage is then visible per project, and a runaway script stops at the limit instead of draining the whole balance.

3. Prepare the VPS

apt update && apt upgrade -ycurl -fsSL https://deb.nodesource.com/setup_22.x | bash -apt install -y nodejsadduser monitor && su - monitormkdir ~/prices && cd ~/prices && npm init -y && npm i undici@6

Keep credentials in a shell-compatible env file (comments on their own lines, no spaces around =):

cat > ~/.proxy.env <<'ENV'# AProxy sub-account for this projectPROXY_HOST=gw-us.aproxy.comPROXY_PORT=2312PROXY_USER=YOUR_SUBACCOUNTPROXY_PASS=YOUR_PASSWORDPROXY_AREA=USENVchmod 600 ~/.proxy.env

Check it from the VPS (the systemd unit later reads the same file through EnvironmentFile; this step is for manual runs):

set -a; . ~/.proxy.env; set +acurl -x "http://$PROXY_HOST:$PROXY_PORT" -U "${PROXY_USER}_area-${PROXY_AREA}:$PROXY_PASS" https://api.ip.cc/

4. The monitor script

The script reads a list of product URLs, fetches each through AProxy, extracts the price and stores it with the page's ETag. Three design choices keep traffic down:

  • One ProxyAgent per run — connections to the gateway are reused instead of opening a new TCP + TLS connection for every request.

  • Raw bytes are counted before decompression — undici.request() does not decompress, so raw.length is the size that actually travelled; the script decompresses it itself for parsing.

  • Conditional requests — on the next run the script sends If-None-Match; unchanged pages answer 304 Not Modified with no body.

// monitor.mjs — price monitor through AProxy (Node.js 20+, undici)import { ProxyAgent, request } from "undici";import { gunzipSync, brotliDecompressSync, inflateSync } from "node:zlib";import { readFile, writeFile } from "node:fs/promises";const { PROXY_HOST, PROXY_PORT, PROXY_USER, PROXY_PASS, PROXY_AREA = "US" } = process.env;// AProxy username parameters: _area-XX for the exit country,// _session-ID + _life-MIN for a sticky session (used together).function proxyUser({ session, lifeMin } = {}) {  let u = `${PROXY_USER}_area-${PROXY_AREA}`;  if (session) u += `_session-${session}_life-${lifeMin ?? 10}`;  return u;}function agent(opts) {  const token = "Basic " + Buffer.from(`${proxyUser(opts)}:${PROXY_PASS}`).toString("base64");  return new ProxyAgent({ uri: `http://${PROXY_HOST}:${PROXY_PORT}`, token, keepAliveTimeout: 30_000 });}function decode(buf, enc) {  if (enc === "gzip") return gunzipSync(buf);  if (enc === "br") return brotliDecompressSync(buf);  if (enc === "deflate") return inflateSync(buf);  return buf;}class StopRun extends Error {}const stats = { requests: 0, bodyBytes: 0, notModified: 0, failed: 0 };const sleep = (ms) => new Promise((r) => setTimeout(r, ms));let delayMs = 1000;                                   // grows on 429async function fetchPage(dispatcher, url, etag) {  for (let attempt = 1; attempt <= 3; attempt++) {    let res;    try {      stats.requests++;      res = await request(url, {        dispatcher,        headers: {          "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0 Safari/537.36",          "accept-encoding": "gzip, br",          ...(etag ? { "if-none-match": etag } : {}),        },        headersTimeout: 30_000, bodyTimeout: 30_000,      });    } catch (e) {      // With HTTPS/CONNECT tunnels, a proxy auth failure surfaces as an error, not a status      if (/\b407\b/.test(String(e?.message))) throw new StopRun("407: proxy authentication failed - check credentials");      await sleep(2 ** attempt * 1000);               // network error / timeout: limited retry      continue;    }    const raw = Buffer.from(await res.body.arrayBuffer());   // bytes as transferred (still compressed)    stats.bodyBytes += raw.length;    const s = res.statusCode;    if (s === 304) { stats.notModified++; return { notModified: true }; }    if (s === 407) throw new StopRun("407: proxy authentication failed - check credentials");    if (s === 403) throw new StopRun(`403 on ${url}: stop and check the site's access terms`);    if (s === 429) {      const ra = Number(res.headers["retry-after"]);      delayMs = Math.min(delayMs * 2, 30_000);        // slow down for the rest of the run      await sleep((Number.isFinite(ra) ? ra : 60) * 1000);      continue;    }    if (s >= 500) { await sleep(2 ** attempt * 1000); continue; }    if (s !== 200) return { failed: s };              // other 4xx: no retry    const html = decode(raw, res.headers["content-encoding"]).toString("utf8");    return { html, etag: res.headers["etag"] };  }  return { failed: "retries exhausted" };}async function main() {  const urls = (await readFile("urls.txt", "utf8")).split("\n").filter(Boolean);  const state = JSON.parse(await readFile("state.json", "utf8").catch(() => "{}"));  const dispatcher = agent();                        // rotating mode, one agent = reused connections  const concurrency = 4;  let i = 0;  async function worker() {    while (i < urls.length) {      const url = urls[i++];      const r = await fetchPage(dispatcher, url, state[url]?.etag);      if (r.html) {        const price = r.html.match(/class="price"[^>]*>([^<]+)/)?.[1]?.trim();        state[url] = { etag: r.etag, price, seen: new Date().toISOString() };      } else if (r.failed) stats.failed++;      await sleep(delayMs * (0.5 + Math.random()));    }  }  try {    await Promise.all(Array.from({ length: concurrency }, worker));  } catch (e) {    if (!(e instanceof StopRun)) throw e;    console.error(e.message);    process.exitCode = 2;  } finally {    await writeFile("state.json", JSON.stringify(state, null, 1));    await dispatcher.close();    console.log(JSON.stringify(stats));  }}main();

Error handling follows simple rules:

  • Timeouts, network errors and 5xx — up to three attempts with growing pauses.

  • 429 — wait for Retry-After, then double the delay between requests for the rest of the run.

  • 403 — stop the run: the site is refusing access, so check its terms instead of retrying.

  • 407 — stop: wrong credentials. With HTTPS targets, the proxy answers the tunnel (CONNECT) request, so undici reports 407 as an error rather than a status code; the script checks for both.

Changing IPs is not a fix for bans or rate limits. If a target limits you, slow down or ask for access.

Sticky sessions for multi-step flows. For a sequence that must come from one visitor (for example, choosing a region on the site and then reading prices), create a separate agent with agent({ session: "cart42", lifeMin: 10 }) and use it for every step of that flow — together with the cookies the site sets. The same session ID alone doesn't carry a login or a cart: the cookies do.

5. How rotation and request volume affect bandwidth

Every proxied request costs more than the page body:

Bytes per request ≈ response body (compressed) + response headers + request headers + connection overhead

The last term is where rotation and connection handling matter:

  • Opening a new connection costs a TCP handshake plus, for HTTPS, a TLS handshake through the tunnel — typically a few kilobytes, mostly the site's certificate chain.

  • Reusing a connection (keep-alive, one agent per run) spreads that cost over many requests.

  • Rotation happens when new tunnels open. With HTTPS, the TLS connection runs end-to-end through the proxy tunnel, so a reused tunnel usually keeps its exit IP while it stays open. Forcing a fresh connection for every request to get a new IP each time means paying the handshake on every request; a sticky session with keep-alive pays it roughly once per session.

  • Lost cookies after an IP change can mean extra redirects or consent pages — more requests per useful page.

And request volume multiplies everything: retries, redirects and re-downloading unchanged pages are all paid traffic. Conditional requests usually save the most.

6. Worked bandwidth estimate

Scenario: 2,000 product pages checked every hour, 30 days a month.

Assumptions (decimal units, 1 KB = 1,000 bytes, 1 GB = 1,000,000 KB):

Assumption

Value

Note

Requests per month

2,000 × 24 × 30 = 1,440,000

before retries

Compressed page body + response headers

45 KB

measured: average of raw.length + headers on a sample

Request headers

0.8 KB

user agent, cookies, If-None-Match

New-connection overhead

6 KB

TCP + TLS handshake, assumed

Extra requests (retries, redirects)

0.05 per request

from the sample's logs

Three ways to run the same job:

Mode

Overhead per request

Bytes per request

Monthly traffic

New connection for every request

6 KB

51.8 KB

1,440,000 × 1.05 × 51.8 KB ≈ 78 GB

Connection reuse (≈50 requests per connection)

0.12 KB

45.9 KB

≈ 69 GB

Reuse + conditional requests (70% of pages unchanged → 304)

0.12 KB

0.3 × 45.9 + 0.7 × 1.3 ≈ 14.7 KB

≈ 22 GB

The 304 responses are counted at about 1.3 KB each (headers both ways plus the shared connection overhead). The lesson: connection reuse saves around 10%, but not downloading unchanged pages saves about two thirds. Check how often your target pages actually change and whether the site returns ETag or Last-Modified — not every site does.

Measured vs billed. raw.length counts the compressed body as received. The decompressed HTML can be several times larger, so measuring it would overstate the estimate. The proxy's billed traffic can also include overhead the script doesn't see. After the first day, compare the sub-account's usage in the AProxy dashboard with stats.bodyBytes from the logs and adjust the per-request figure.

7. Schedule it with systemd

Each run finishes and exits, so use a oneshot service with a timer:

# /etc/systemd/system/prices.service[Unit]Description=AProxy price monitor (one run)After=network-online.targetWants=network-online.target[Service]Type=oneshotUser=monitorWorkingDirectory=/home/monitor/pricesEnvironmentFile=/home/monitor/.proxy.envExecStart=/usr/bin/node monitor.mjs
# /etc/systemd/system/prices.timer[Unit]Description=Run the price monitor hourly[Timer]OnCalendar=hourlyRandomizedDelaySec=300Persistent=true[Install]WantedBy=timers.target
systemctl daemon-reload && systemctl enable --now prices.timerjournalctl -u prices -n 20      # the last line of each run is the JSON stats

Persistent=true catches up on a run missed during a reboot. A long-running worker that never exits would instead use a normal service with Restart=on-failure.

8. What to watch

The JSON line each run prints is enough for basic monitoring: requests (should stay near the URL count), bodyBytes per request (a sudden drop often means error pages), notModified (how much conditional requests are saving) and failed. Compare daily totals with the sub-account usage in AProxy, and revisit the estimate when you add URLs or change the schedule.

Summary

Your residential traffic bill depends not only on the number of pages but also on rotation mode, connection reuse, retries and conditional requests. Measure bytes per request on a small sample, multiply by your real volume and compare the estimate with the sub-account usage. To keep the monitor running on schedule without your own computer, a small PSB Hosting VPS is enough; for heavier parsing, look at Hi-CPU VPS.

Related articles

What Is Hosting in Simple Terms and What Types of Hosting Are There

What Is Hosting in Simple Terms and What Types of Hosting Are There

For a website to open for visitors, its files must sit on a computer that is always on and connected to the internet. Hosting is a service where a provider gives you space and resources on such a comp

What Is a Server in Simple Terms: Types of Servers and What They Are For

What Is a Server in Simple Terms: Types of Servers and What They Are For

The word “server” sounds technical, but the idea behind it is simple. A server is a computer that runs around the clock and answers requests from other devices: it serves website pages, stores files,

Setting Up Residential Proxies on a VPS: A Step-by-Step Guide with a Worked Traffic Estimate

Setting Up Residential Proxies on a VPS: A Step-by-Step Guide with a Worked Traffic Estimate

Residential proxies are usually billed per gigabyte, so the two questions people ask before starting a data project are “how do I wire the proxy into my scraper?” and “how much traffic will it actuall

Running a Scraper on a VPS with Residential Proxies: Setup, Sticky Sessions and a Traffic Estimate

Running a Scraper on a VPS with Residential Proxies: Setup, Sticky Sessions and a Traffic Estimate

A scraper that runs on a laptop stops when the lid closes, the Wi-Fi drops or the system restarts for updates. Moving it to a VPS makes it far more available — the server keeps running when your own m

FlashID Review 2026: Anti-Detect Browser for Managing Multiple Accounts at Scale

FlashID Review 2026: Anti-Detect Browser for Managing Multiple Accounts at Scale

Partner content: FlashID. In today’s hyperconnected world, cross-border e-commerce and social media marketing have become essential growth drivers for modern businesses. However, global teams

Testing Ads and Apps for Southeast Asia: a VPS Plus a Singapore Mobile IP

Testing Ads and Apps for Southeast Asia: a VPS Plus a Singapore Mobile IP

If you run ads or launch an app for Southeast Asia, what you see from your office is not what your users see. Ad networks, app stores and many websites show different creatives, prices, languages and

How to Add the DiveChat Live Chat to a Website on a VPS

How to Add the DiveChat Live Chat to a Website on a VPS

Partner guide: PSB Hosting × DiveChat. A live chat on your website gives visitors a quick way to ask a question at the moment they are ready to buy, instead of filling in a form and waiting. If

403 Forbidden Error: Causes and How to Fix It

403 Forbidden Error: Causes and How to Fix It

A 403 Forbidden error means the server understood the request but refuses to fulfil it: access to the page or file is not allowed. Unlike 5xx errors, the server is working here — it has simply d

9HTTP: Global Proxy IP Solutions for Cross-Border Business and AI Applications

9HTTP: Global Proxy IP Solutions for Cross-Border Business and AI Applications

Partner content: 9HTTP. As businesses expand into global markets, data collection, market research, SEO monitoring, ad verification, and AI-related applications require increasingly diverse network e

Telegram