Every new HTTPS connection costs two round trips before your request can leave: one for TCP, one for TLS 1.3. If your client throws connections away between requests, you pay that again and again, and the S3 server never complains. It just looks slow.
We counted connections for four clients (urllib3, boto3, aiohttp and Go's net/http) on 10,000 requests each, at 1, 8 and 32 workers, with default settings, with a pool sized to the workers, and with a new client for every request. The server side did the counting, so the numbers are not what the library thinks it did.
The setup
- A stand-in server behind nginx 1.31 with TLS 1.3 on loopback, answering every GET with a 4 KB body after a fixed 5 ms. It is not an S3 server: we wanted one thing, connection behaviour. A real S3 first byte is slower, so your ratios will be gentler.
- Clients: urllib3 2.8.0, boto3 (the same urllib3 underneath, signing every request), aiohttp 3.14.5, Go 1.27.4 net/http. Python 3.13. The cert is verified against a local CA in every client.
- nginx logs
$connection, a number unique per TCP connection. We count the distinct numbers: that is how many connections the server saw. - Sized pool means: urllib3
maxsize=workers, boto3max_pool_connections=workers, GoMaxIdleConnsPerHost=workers. aiohttp's connector already allows 100 per host, so it only has a default row. - New client per request is the
requests.get()/aiohttp.ClientSession()inside the handler habit. These runs use 3,000 requests, because macOS runs short of free local ports above that.
Steady load: default pools are fine, except in Go
10,000 requests, workers always busy. Connections the server saw:
| Client / setting | 1 worker | 8 workers | 32 workers |
|---|---|---|---|
| urllib3 default | 1 | 8 | 32 |
| urllib3 sized pool | 1 | 8 | 32 |
| boto3 default (pool of 10) | 1 | 8 | 32 |
| boto3 sized pool | 1 | 8 | 32 |
| aiohttp default | 1 | 8 | 32 |
| Go default | 1 | 73 | 240 |
| Go sized pool | 1 | 8 | 32 |
| New client per request (3,000 requests) | 3,000 | 3,000 | 3,000 |
Python's defaults held up here. Our reading: under sustained load a connection is back in use before the pool is full of idle ones, so nothing gets dropped. Go's default is different: <code>http.DefaultTransport</code> keeps at most 2 idle connections per host. With 8 busy workers, Go closed and reopened connections 65 extra times in 10,000 requests, and 208 extra times with 32.
Per-request cost of a new connection
| Client | Reused connection p50 | New connection each time p50 | Added by connect + TLS |
|---|---|---|---|
| urllib3 | 7.9 ms | 11.4 ms | 3.5 ms |
| aiohttp | 7.3 ms | 11.8 ms | 4.5 ms |
| Go | 7.3 ms | 10.5 ms | 3.2 ms |
These are one-worker runs on loopback, so 3 to 4 ms is pure CPU and kernel work: a TLS 1.3 handshake with an ECDSA certificate plus TCP setup. The request itself is 7 ms (5 ms server time plus the client). No network distance is in these numbers. That part you can calculate.
The round-trip arithmetic
- A new TLS 1.3 connection needs 1 round trip for TCP and 1 for the TLS handshake (RFC 8446). The request goes out after that, so it takes 3 round trips instead of 1.
- Extra wait per request on a new connection = 2 × RTT.
- At 20 ms RTT: +40 ms. At 40 ms: +80 ms. At 100 ms (cross-ocean): +200 ms. TLS 1.2 adds one more round trip.
Go's default at 32 workers opened 208 extra connections. At 40 ms RTT that is 208 × 80 ms = 16.6 s of waiting, spread over 32 workers: about 0.5 s each, on a job that took 2 s on loopback. That is a 25% slower job from one setting.
Bursty load: where Python's defaults break
Web handlers and cron jobs do not run flat out. We sent 32 requests together, idled 100 ms, and did that 100 times (3,200 requests). While idle, a pool smaller than 32 can only keep a few connections, and the rest are closed. The next burst reconnects.
| Client / setting | Connections for 3,200 requests | p50 | p95 |
|---|---|---|---|
| urllib3 default (pool of 1) | 3,098 | 26.5 ms | 32.1 ms |
| urllib3 pool of 32 | 32 | 11.8 ms | 14.8 ms |
| boto3 default (pool of 10) | 1,909 | 24.0 ms | 35.3 ms |
| boto3 pool of 32 | 32 | 17.8 ms | 31.8 ms |
| aiohttp default | 32 | 7.2 ms | 8.7 ms |
| Go default (2 idle per host) | 2,841 | 22.3 ms | 27.6 ms |
| Go idle pool of 32 | 32 | 8.9 ms | 10.6 ms |
urllib3 defaults opened a new connection for 97% of the requests; the sized pool opened 32 once and kept them. The loopback p50 more than halved for urllib3 and Go. At 40 ms RTT, the urllib3 default's 3,098 new connections are 3,098 × 80 ms = 248 s of handshake waiting; the sized pool's 32 are 2.6 s.
aiohttp's default connector kept all 32 through the 100 ms idle, because it holds idle connections for 15 seconds by default and has no per-host cap below 100.
What to set
- Set the pool to the number of requests you make at once, not to the average. A thread pool of 32 means a pool of 32.
- Make one client at startup. Do not create it inside the request handler. boto3 clients are thread-safe.
- Read the whole body, or close it. A response you do not finish reading keeps its connection out of the pool (Go and urllib3 both).
- Check from the server: if your logs show a new connection per request, the client is not reusing. For an S3-compatible endpoint, a count of distinct source ports over a minute does the same job.
Pooling matters most for many small objects. If your uploads are large, tune parts first: multipart concurrency in boto3. When the server pushes back, see retries under 503 SlowDown.
Use any S3 client with an S3-compatible endpoint and scoped access keys.
Explore tport.spaceTest record and sources
- Run on 2026-11-14 on one Mac, loopback. 10,000 requests per steady run; 3,000 for new-client runs; 3,200 for bursts. One run per cell, so treat differences under about 10% as noise. Connection counts were exact and repeatable.
- Not tested: real S3 or tport.space latency, HTTP/2, session resumption (no client resumed a TLS session), proxies, and Python sessions from
requests. - Sources: RFC 8446 (TLS 1.3 handshake is one round trip), Go net/http (
DefaultMaxIdleConnsPerHostis 2), urllib3 pool behaviour (maxsize, connections over it are discarded), botocore Config (max_pool_connectionsdefault 10), aiohttp TCPConnector (limit100,keepalive_timeout15 s).