-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
SocketsHttpHandler should use first available connection (don't wait on new connection creation) #44818
Comments
Tagging subscribers to this area: @dotnet/ncl Issue Details
|
Could the same approach be used for HTTP/2 when EnableMultipleHttp2Connections is enabled? |
Potentially, yeah. It's a different set of logic though. The way EnableMultipleHttp2Connections works is a bit wonky today, so we should probably consider this as part of a general cleanup here. |
Seems like a reasonable thing to do, albeit likely adding some implementation trickiness (in particular when it intersects with a set MaxConnectionsPerServer) to what is largely a straightforward process today. |
AB#1254012
Currently, when we have no idle HTTP/1.1 connections (and are not at the connection limit) and a new request comes in, we will create a new connection and then use it for the new request.
The connect itself may take a while, especially for HTTPS connections. During this time, an existing connection may complete its current request and become available. If so, we should just use this idle connection instead of waiting for the new connection to finish its connect.
This should help request latency, and probably reduce the number of connections created during burst usage as well (see #43764).
More details:
When this happens, the new connection can still be put in the pool as idle, even if we don't have a request for it at the moment. If another new request comes in, we will use it like any other idle connection.
Note also that we should avoid creating new connections when we already have enough pending connections to (eventually) handle all the pending requests. Consider this scenario, starting with no connections:
The text was updated successfully, but these errors were encountered: