-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Azure SDKs for Python should support custom urllib3 connection pool size. #12102
Comments
Hi @ctstone You should be able to pass your own session: import requests
sess = requests.Session()
adapter = requests.adapters.HTTPAdapter(pool_connections=100, pool_maxsize=100)
sess.mount('https://', adapter)
client = ContainerClient.from_connection_string(
connection_string,
container_name,
session=sess
) Could you try and let me know? I will try to get some time to try it too, but can't tell when precisely. Thanks! |
Thanks @lmazuel, this works great! adapter = HTTPAdapter(pool_maxsize=thread_count) However, Might I suggest adding it to all client doc strings? |
@ctstone yes, the entire set of supported kwargs is not obvious, there is a generic list here with most of them: And this one was missing, so I created another issue: That makes the doc complete, but not discoverable, so created another issue: Shall we close this one? Additional thoughts? |
Closing this issue since it's fixed in the provided solution. Thanks! |
Is your feature request related to a problem? Please describe.
When I run the Storage SDK against a single account using a ThreadPool,
multiprocessing.pool.ThreadPool
, I see frequent warnings likeurllib3.connectionpool:HttpConnectionPool is full, discarding connection
. Urllib3 has a well-defined default connection pool max size of 10. When myThreadPool
is larger than the default, the warnings are frequent, probably correlating with an increase in round trip time.Describe the solution you'd like
The ideal change would mean I can easily configure the underlying connection pool size. Maybe other parameters too, like number of pools.
Describe alternatives you've considered
I can eliminate the warnings on a 32-count pool using this workaround that patches the urllib3 pool parameters.
Additional context
Repro:
The text was updated successfully, but these errors were encountered: