PacketStream documentation

Rotation and sticky sessions

Understand PacketStream's connection-based rotation and use sticky sessions to keep one residential exit for a related workflow.

PacketStream supports automatic rotation and sticky sessions for all direct proxy customers. Choose behavior based on the unit of work—not on an assumed one-request-per-IP model.

Automatic rotation

With an unmodified auth key, PacketStream selects a residential exit for each new proxy connection.

Username: USERNAME
Password: AUTH_KEY

An HTTP library, browser, or connection pool can send multiple requests over one proxy connection. Those requests can therefore continue through the same exit. Opening a new page or calling a request function again does not necessarily create a new proxy connection.

Automatic rotation is a good fit for independent work where one request does not depend on the identity used by another.

Observe new connections with cURL

Each iteration below starts a separate cURL process and therefore establishes its own proxy connection:

for attempt in 1 2 3 4 5; do
  curl --silent --show-error --fail-with-body \
    --proxy 'https://proxy.packetstream.io:31111' \
    --proxy-user "${PACKETSTREAM_USER}:${PACKETSTREAM_AUTH_KEY}" \
    'https://ipinfo.io' \
    | jq -r '[.ip, .country, .org] | @tsv'
done

A small sample is not guaranteed to contain a different IP on every line. The contract is exit selection for each new connection, not uniqueness across a sample.

Sticky sessions

Append _session- and a workflow label to the auth key:

AUTH_KEY_session-catalog42

Requests using that session can retain the same residential exit for up to 60 minutes. Sticky sessions are available to all customers.

SESSION_PASSWORD="${PACKETSTREAM_AUTH_KEY}_session-catalog42"

curl --silent --show-error --fail-with-body \
  --proxy 'https://proxy.packetstream.io:31111' \
  --proxy-user "${PACKETSTREAM_USER}:${SESSION_PASSWORD}" \
  'https://ipinfo.io' \
  | jq '{ip, country, org}'

Use one session label for one related workflow. Separate concurrent workflows should use separate labels.

Session failure behavior

A sticky session depends on the Packeter providing its exit. If that Packeter disconnects, the session fails. PacketStream does not silently switch the session to a different identity.

Design recovery around the whole stateful workflow:

  1. stop the failed workflow;
  2. discard state that cannot safely continue with a new identity;
  3. select a new session label;
  4. restart from a known checkpoint;
  5. keep the retry count and total recovery time bounded.

Do not reuse a failed session indefinitely in a tight retry loop.

Combine a country and session

Place both modifiers on the auth key when a workflow needs country targeting and continuity:

AUTH_KEY_country-US_session-catalog42

The country rule still applies. If no exit is available in the selected country, the request fails instead of falling back to another location.

Choose the right behavior

WorkloadStarting point
Independent public-page checksAutomatic rotation
Several steps that must share one exitSticky session
Location-sensitive independent checksCountry targeting with automatic rotation
Location-sensitive multi-step workflowCountry targeting with a sticky session

The application remains responsible for its own concurrency, timeouts, retries, and connection-pool configuration.

Questions? We’re here to help. Talk with our support team about your integration.
Contact support