# Use rotating proxy sessions

Use rotating sessions with username and password authentication. Understand how TCP connection reuse affects exit IP selection.

Rotating mode uses username and password authentication. A new TCP connection goes through exit IP selection. Two consecutive connections can use the same exit IP.

## How connections affect rotation

- HTTP keep-alive lets several requests share one TCP connection.
- Open a new connection to test rotation. Sending another HTTP request can reuse an existing connection.
- Connection pool size affects the number of concurrent proxy sessions.

## Configure your client

- Keep separate connection pools for different tasks and locations.
- Set limits for idle connections and configure an idle timeout.
- Avoid reconnecting repeatedly to force a different exit IP.

## Retry transient failures

- Retry only when the operation is safe to repeat, and limit the number of retries.
- Use exponential backoff with jitter.
- Respect HTTP 429 responses and explicit stop signals from the destination.

## Log connection details

- Record the connection phase, location, redacted subaccount identifier, and request ID.
- Keep full proxy credentials out of logs.
