Repository navigation
Preserve sync HTTP pools across discovered cluster nodes - #161
Conversation
Botocore leaves urllib3's host cache at ten entries even when Alternator routes across a larger cluster. Grow each client's existing cache from its seed, routing and affinity snapshots so revisiting healthy nodes reuses their connections. Cover resources, topology growth, lazy proxy managers and TCP reuse without changing the per-host connection setting. Fixes #159
Code Review by QodoResolved findings 1.
|
Describe discovery separately from its connection lifecycle so the data pool documentation also applies when discovery pooling is introduced. Refs #159
Count a request's destination when its captured query plan outlives the current topology. Select and grow its SDK pool manager under a client-local lock before sending, so concurrent first proxy requests share a sized manager without iterating the lazy manager registry. Cover topology handoff and concurrent proxy first use for clients and resources, and verify reconnects after a server closes a connection. Refs #159
A captured request plan can visit several retired destinations after a topology update. Counting only one selected destination still allows those pools to evict reusable pools belonging to the current snapshots. At the SDK's actual cache insertion, grow capacity for known nodes and promote current entries so normal eviction prefers retired pools. Delegate lookup and disposal to the existing manager under its cache lock, and keep cached requests on the normal path. Normalize host keys through urllib3. Cover repeated handoffs and concurrent retired destinations for direct and HTTPS proxy managers without retaining an unlimited host history. Refs #159
Read topology snapshots only after acquiring the SDK cache lock on a miss, so an older waiting lookup cannot evict pools for a replacement topology. Coordinate lazy proxy creation through the SDK's original getter instead of before-send. This keeps proxy preparation inside the SDK's exception mapping and standard retry path while retaining its managers and settings. Add focused regressions for overlapping topology replacement, malformed unselected hosts, and proxy failure classification and retries. Refs #159
Cache misses now account for the selected destination and protect pools for the seed and observed routing/affinity snapshots. Snapshot reads, recency promotion, and insertion share the cache lock. Regressions cover topology replacement after routing, waiting lookups, and repeated retired destinations with direct and HTTPS proxy managers.
The original SDK proxy getter now serializes lazy construction and installs the sizing hook before the manager’s first pool lookup, without iterating the registry. Added concurrent first-request coverage for clients and resources, plus a regression preserving SDK proxy-error mapping and standard retries. The per-host connection limit is unchanged. |
urllib3 preserves IPv6 zone case while parsing URLs but lowercases host names in pool keys. Apply the same normalization to protected hosts so retired destinations cannot evict a current scoped IPv6 pool. Extend the existing retention regression with this case and remove obsolete synthetic before-send setup from the pool tests. Refs #159
Move topology-handoff and concurrent pool setup inside each test's client cleanup scope. Pool lookups, proxy construction or lock patching can fail before the assertions, and those failures must still close the client. Keep barrier and event cleanup scoped to their initialized setup while preserving the existing assertions and concurrent schedules. Refs #159
Summary
Sync clients and resources could open a fresh TCP connection on every request when cycling through more than ten nodes because botocore leaves urllib3's host-pool cache at its default size. Grow the existing cache to cover seed, routing, and key-affinity nodes, including topology changes and lazily created proxy managers.
Keep
max_pool_connectionsas the per-host connection limit and preserve the existing transport's TLS, proxy, retry, and timeout settings. Regression coverage checks that two passes through eleven HTTP endpoints reuse eleven TCP connections.Fixes #159. Synchronous discovery pooling is tracked separately in #160.