No KYC — no ID, no selfie, no documents. Pay in crypto: BTC, USDT, USDC, ETH, SOL, LTC
Language: English
Get started

Docs · sessions · rotation · keep-alive · checked 13 November 2026

How do sticky sessions and IP rotation work on a residential proxy?

Rotation follows connections, stickiness follows the session ID. Once you know how a library reuses connections, you decide exactly when the IP changes.

Last updated: · 7 min read

Quick answer

How do sticky sessions and IP rotation work on a residential proxy?

CrawlRelay gives a username without a session ID an IP from the pool on every new TCP connection, usually a different one. Adding -session-<id>-ttl-<minutes> keeps one IP for 1 to 30 minutes, though it can change earlier if the device goes offline. Keep-alive, not the HTTP request, decides when the IP really changes.

In brief
  • Rotation unit: the TCP connection; a kept-alive connection keeps its exit for every request on it.
  • Sticky: session and ttl in the username, from 1 to 30 minutes, the same range the client-area generator offers.
  • Early change: a residential device going offline ends the session before its ttl.
  • Shared IDs: clients sending the same session ID share one exit.
  • Price: sessions and rotation are included; $0.50/GB from 50 GB up to 1 TB.

What are the session rules at a glance?

What are the session rules at a glance?
Rotation unitAn IP from the pool per new TCP connection, usually a different one
Sticky session-session-<id>-ttl-<minutes> appended to the username
Session lengthup to 30 minutes, set with ttl from 1 to 30 minutes
Session IDLowercase letters and digits, such as a1b2c3d4; one ID per flow
What ends a session earlyThe residential device behind it going offline
Shared IDsClients that send the same ID share the same exit
CostNone: sessions and rotation are included in the per-GB price

What happens at the gateway when I send a session ID?

The gateway reads the username on each new connection and keeps the same exit for a session ID until its ttl ends. Without a session part, it picks a residential exit that matches the targeting for that connection only.

A sticky IP is a real household connection, so it can disappear before the ttl ends: the device is switched off, loses Wi-Fi or changes network. Long flows must survive that by checking the exit IP at checkpoints and restarting from a checkpoint instead of failing the whole job.

How does each library reuse connections?

Every request on a kept-alive connection shares one exit, so each library's pooling decides when the IP changes. This is how to get each behaviour on purpose.

Connection reuse in seven HTTP clients and how to rotate or stick with each
LibraryDefaultNew IP per requestOne IP for a flow
Python requestsSession keeps connections aliveHeader Connection: close, or a new Session per requestOne Session with a session ID in the username
httpxClient pools connectionshttpx.Limits(max_keepalive_connections=0)One client per session ID
aiohttpTCPConnector pools connectionsTCPConnector(force_close=True)Session ID in the proxy URL username
ScrapyPools per proxy credentials and hostmeta={"proxy_session": "new"} with the CrawlRelay middlewareA fixed proxy_session for the flow
Playwright / PuppeteerChrome pools per contextNew context per pageOne context per session ID
Node.js undici, axios, gotAgents keep sockets aliveNew agent per request, or keep-alive offOne agent per session ID
curlOne connection per commandAlready the caseSame session ID in each command

Which session strategy fits which scraping job?

Rotate for independent pages and stick for anything that carries state from one page to the next.

Session strategy and suggested ttl for six scraping jobs
JobStrategySuggested TTL
Independent product, article or listing pagesRotate: no session ID—
Pagination whose next page depends on a cookie or cursorOne sticky session per listing10–30 min
Search, then results, then detail pagesOne sticky session per search10–20 min
Headless browser rendering several pages of one siteOne sticky session per browser contextThe context's life, up to 30 min
Checking what a page shows in several citiesOne short session per city check5 min
Re-checking the same page every hourRotate—

How do I manage a pool of sticky sessions in Python?

Keep a small pool of sticky sessions and retire each one after a set number of requests or when its exit fails. Failing here means 502, 503 or 504. Note what the pool does not do: it does not swap IPs to get past a 403 or a 429. Those mean the site wants a slower pace, so the pool raises them to the calling code.

Python: a pool of sticky sessions
import random
import uuid

import requests

GATEWAY = "gw.crawlrelay.com:7777"
BASE_USER, PASSWORD = "USERNAME-country-us", "PASSWORD"


class SlowDown(Exception):
    """The target asked us to slow down (403 or 429): back off, do not rotate."""


class StickySession:
    def __init__(self, ttl=15, max_requests=50):
        self.id = uuid.uuid4().hex[:10]
        self.max_requests, self.used = max_requests, 0
        user = "%s-session-%s-ttl-%d" % (BASE_USER, self.id, ttl)
        proxy = "http://%s:%s@%s" % (user, PASSWORD, GATEWAY)
        self.http = requests.Session()
        self.http.proxies = {"http": proxy, "https": proxy}


class SessionPool:
    EXIT_PROBLEMS = {502, 503, 504}

    def __init__(self, size=5, **options):
        self.options = options
        self.sessions = [StickySession(**options) for _ in range(size)]

    def _replace(self, i):
        self.sessions[i].http.close()
        self.sessions[i] = StickySession(**self.options)

    def get(self, url, **kwargs):
        i = random.randrange(len(self.sessions))
        s = self.sessions[i]
        s.used += 1
        try:
            r = s.http.get(url, timeout=(10, 30), **kwargs)
        except requests.exceptions.RequestException:
            self._replace(i)  # dropped exit or timeout: start a fresh session
            raise
        if r.status_code in (403, 429):
            raise SlowDown("%s returned %d" % (url, r.status_code))
        if r.status_code in self.EXIT_PROBLEMS or s.used >= s.max_requests:
            self._replace(i)
        return r


pool = SessionPool(size=5, ttl=15, max_requests=50)
print(pool.get("https://api.ipify.org").text)

How do I know that a sticky IP has changed?

Ask an IP echo service through the same session at the start of a flow and at each checkpoint, and compare the answers. A change means the exit behind the session changed: restart the flow from its last checkpoint, or open a new session. Log it with the session ID so IP changes stay distinguishable from site behaviour while debugging. The proxy generator in the client area writes its test command against an IP and location service for the same reason.

Which session mistakes cost the most?

Rotating inside a stateful flow and reading a 429 as an IP problem waste the most traffic and time. - Rotating on every request of a multi-step flow. The site sees a cart, a cursor or a search token jump between countries and resets it.

  • One session ID for every worker. A session is meant for one flow; give each worker and each flow its own ID.
  • Sessions far longer than the job. A 30-minute ttl for a 2-minute flow keeps an IP busy for nothing and makes logs harder to read.
  • Treating a 429 as an IP problem. A new IP does not change the site's rule; slowing down does. See 429 Too Many Requests.
  • Assuming rotation per request. Keep-alive keeps the exit; check the table above for your library.

Do sessions change what a crawl costs?

No: CrawlRelay bills bytes, and sessions, rotation and targeting are included in the per-GB price. A sticky session can even lower the bill, because one kept-alive connection avoids a new TLS handshake for every request.

According to CrawlRelay's survey of 13 October 2026, the median residential price was $1.20/GB at 1 TB across 12 offers. CrawlRelay sells 1 TB for $500, the same $0.50/GB rate that applies from 50 GB. The price comparison shows the medians at every volume, and the Python guide shows sticky and rotating clients side by side.

Sessions and rotation: questions

How long does a CrawlRelay sticky session last?

Sticky sessions keep the same IP for the time you set (ttl, in minutes), up to 30 minutes. The IP can change earlier, for example if the residential device goes offline. CrawlRelay accepts a ttl from 1 to 30 minutes; choose one slightly longer than the flow it serves.

Is rotating on every request better for scraping with CrawlRelay?

For independent pages, rotating spreads load across CrawlRelay exits. For pagination tied to a cookie it breaks the flow, so most crawls rotate between items and stay sticky within a flow.

Can I choose the exact CrawlRelay IP I get?

No. CrawlRelay assigns exits from a pool that changes all the time, matching the targeting in the username. Country, city, US state, ZIP code and ASN can be chosen, and a session keeps an IP, but no address can be reserved.

Do two CrawlRelay sub-users with the same session ID share an IP?

Two clients sending the same session ID share one exit, so give every worker and every flow its own ID. Sub-users keep separate logins and traffic limits on CrawlRelay; session IDs keep exits apart.

Verdict
  • Rotate by default for independent pages, with keep-alive off where the client pools connections.
  • Stick with a ttl just above the flow length, at most 30 minutes, for pagination, search flows and browser contexts.
Sources (2)
  1. RFC 9112, HTTP/1.1: persistent connections — IETF (read 2026-11-13)
  2. httpx resource limits (max_keepalive_connections) — Encode (read 2026-11-13)

Rotation and sessions are in every plan

$1.50 for 1 GB, $500 for 1 TB; traffic never expires.

From $0.50/GB · no KYC

Get started