ProxiesScraping

How Long Should a Sticky Session Last? Proxy Session Length by Task

AE
Engineering desk
Published
November 29, 2026
Reviewed by
Read Time
5 min read
Sticky session length by task: a few minutes for search pages, 10 to 30 minutes for logins and checkouts, longer for slow crawls, up to 24 hours for a daily monitor

Short answer: A sticky session should last as long as one task takes, plus a margin, and no longer. A sticky session is a proxy setting that keeps the same exit IP across a series of requests for a set time, so a login, a cart or a paginated search looks like one visitor. On Aethyn the length is set in the username with lifetime-<minutes>, anywhere from 1 minute to 24 hours, and it defaults to 30 minutes. The right number comes from the job, not from a rule of thumb: estimate how long the task runs, multiply by about 1.5 for slow pages and retries, and use that. Holding an IP longer than the task needs does not make it safer. It concentrates more requests on one household address, and because that address is a real home connection, a very long hold is more likely to end early anyway. Use sticky residential proxies for the task itself and rotate between tasks.

Starting points by task

These are starting points to adjust after a test run, not measured limits. Time one real run of your task and size the window from that.

TaskWhat has to stay on one IPStarting lifetime
Search results for one keyword, a few pages deepPage one to the last page2 to 5 minutes
Login, then read a handful of account pagesThe login cookie and the pages after it10 to 15 minutes
Add to cart and check outEvery step of the checkout15 to 30 minutes
Paginated walk through one listing or categoryEvery page of the walkPages × seconds per page × 1.5
One working session in a managed accountThe whole session, same IP each time30 to 60 minutes, renewed per session
Long-lived logged-in monitorThe session cookie for a dayUp to 24 hours, with a retry plan

The default of 30 minutes covers most logins and checkouts. Shorten it for quick tasks so the exit goes back into the pool sooner. Lengthen it only when a single task really runs longer, such as a slow crawl through hundreds of pages or a dashboard you keep logged in all day.

Why a longer session is not safer

A long hold feels like the cautious choice, and it usually is not. Every request in a sticky session leaves from the same household address, so a long session that keeps sending requests concentrates that traffic on one IP, which is what per-IP rate limits measure. Rotation exists to spread that load. The second cost is reliability. A residential exit is someone's home connection, so it can drop or change before your window ends, and the longer the window, the more likely that is. When the window ends, the same session ID can be given a fresh IP. Build long flows to survive one unexpected change: detect the block or logout, open a new session ID, and restart the current step rather than the whole job. The short sessions in the table above rarely hit this. A 24-hour monitor almost certainly will at some point, so plan for it from the start.

Size the lifetime from the job

The helper below turns a task's page count and pace into a lifetime, caps it at Aethyn's 1 to 1440 minute range, and builds the username. Session IDs must not contain a dash, so it uses a random hexadecimal ID. On a 403 or 429 it opens a new session, which means a new exit, instead of retrying on the blocked one.

Code Snippet
import math
import secrets

import requests

BASE_USER = "aethyn-XXXXX-country-us"
PASSWORD = "PASSWORD"
GATEWAY = "proxy.aethyn.io:2099"


def lifetime_minutes(pages: int, seconds_per_page: float, margin: float = 1.5) -> int:
    """How long to hold one exit: the task's expected duration plus a margin."""
    minutes = math.ceil(pages * seconds_per_page * margin / 60)
    return max(1, min(minutes, 1440))  # Aethyn accepts 1 to 1440 minutes


def sticky_proxies(lifetime: int) -> dict:
    session_id = secrets.token_hex(4)  # letters and digits only, no dashes
    user = f"{BASE_USER}-session-{session_id}-lifetime-{lifetime}"
    proxy = f"http://{user}:{PASSWORD}@{GATEWAY}"
    return {"http": proxy, "https": proxy}


# A 40-page paginated walk at about 6 seconds a page: hold the exit 6 minutes.
lifetime = lifetime_minutes(pages=40, seconds_per_page=6)
proxies = sticky_proxies(lifetime)
for page in range(1, 41):
    r = requests.get(f"https://example.com/search?q=widgets&page={page}", proxies=proxies, timeout=30)
    if r.status_code in (403, 429):
        proxies = sticky_proxies(lifetime)  # new session id, new exit; restart the walk here

The code on this page was run on November 29, 2026 against a local stand-in proxy that checks the login (Python 3.14, requests 2.34), not against live targets or the Aethyn gateway. In that run all 40 requests used one session username, as intended. Replace aethyn-XXXXX and PASSWORD with your own credentials.

Renewing and reusing a session

Reusing the same session ID inside the window returns the same exit. That is how you keep one identity per account across many requests: derive the session ID from the account, not from the request. For work that repeats every day, such as checking the same account each morning, open a fresh session ID for each run instead of trying to hold one IP from day to day. A household IP is not a static address, and treating it as one is the most common reason long-session setups fail. If you need an address that never changes for months, that is a static or ISP proxy, which Aethyn does not sell. The difference is covered in rotating vs static residential proxies.

When not to use a sticky session

If each request is an independent page, such as product pages, price checks or single search queries, skip the session entirely and use rotating residential proxies. Every request then gets a fresh exit and no single address carries the volume. The full username syntax, including country and city targeting, is in sticky proxies explained and the targeting reference. Sticky sessions work the same way on Premium, from €2.00/GB, and Elite, from €4.50/GB.

FAQ

Sticky session length questions

How long should a sticky session last?
As long as one task takes plus a margin of about 50 percent, and no longer. Logins and checkouts usually fit inside the 30-minute default; a few search pages need only a few minutes; a slow crawl through hundreds of pages may need an hour or more.
What is the maximum sticky session length on Aethyn?
24 hours. Set lifetime-1440 in the username. The minimum is 1 minute and the default, with no lifetime set, is 30 minutes.
Is a longer sticky session better for avoiding blocks?
No. A long session concentrates every request on one household IP, which is what per-IP rate limits watch, and a home connection can drop before a long window ends. Use the shortest window that covers the task.
What happens when a sticky session expires?
The next request with the same session ID can be given a fresh IP. If your flow depends on one IP, detect the change, open a new session ID and restart the current step.
Share this article

Guides, integrations & docs

Continue reading

Sticky sessions from 1 minute to 24 hours

Set the lifetime in the username on Premium (from €2.00/GB) or Elite (from €4.50/GB). Rotation is the default when you leave it out.

Back to all articles