httpcore connection pooling for HTTP2 blocks requests due to max streams semaphore #1028
Unanswered
manishrjain
asked this question in
Potential Issue
Replies: 1 comment
-
|
Any thoughts? Or, should I file this as an issue? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When using httpx.Client, which internally uses httpcore connection pooling with HTTP/2, even if max_connections are set to higher values -- once you have more than 100 concurrent requests, they get blocked due to the _max_streams_semaphore.acquire. When ideally, what you'd like to see is a new connection getting created to handle the new request.
With 256 concurrent requests, the pool would send 100, then block until they return -- all on just one connection. Conversely, with HTTP/1.1, it immediately spins up new connections, one per request, so all 256 concurrent requests are able to run.
I couldn't find any way to go around this limitation and somehow get the pool to open up new connections. Ideally, the library should indicate to the pool to create new connections when it hits the max_streams limit.
Ultimately, I had to build my own connection pooling which would consider the number of concurrent streams per connection, and then just spin up new connections and route requests keeping track of their streams.
Beta Was this translation helpful? Give feedback.
All reactions