Allow configuring HttpClient creation
See original GitHub issueAs part of our performance guidelines, we suggested to customers to tweak ServicePointManager.DefaultConnectionLimit
to improve Storage operations. This relevant both for getting data as well as receiving data. With .NET Core the ServicePointManager.DefaultConnectionLimit
is not taken into account with the HttpClient
anymore. There is a new property called MaxConnectionsPerServer
on the HttpClientHandler
that needs to be set when the HttpClient
is created. The default value of that property is int.Max
. With massive concurrent storage operations, the async code running on .NET Core will create thousands of connections which makes the storage operation code slow on .NET Core.
AWS SDK has a possibility to override certain settings of the HttpClient
or HttpClientHandler
when a client is created. For example MaxConnectionsPerServer
can be set on the client configuration object with .NET Core. This allows tweaking the default behaviour of the HTTP client handler.
new AmazonSQSClient(
credentials,
new AmazonSQSConfig
{
RegionEndpoint = region,
MaxConnectionsPerServer = someValue,
})
It would be really beneficial if the HttpClient
creation can be somehow controlled or at least configuration like MaxConnectionsPerServer
can be set on the created HttpClient
to be able to tweak performance if necessary.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:17 (9 by maintainers)
Top GitHub Comments
For those using Functions v2, can you give our latest release (anything >= 2.0.12210.0) a try with your scenarios? At the time of this writing, this version is rolling out worldwide, so it may not quite be in all regions just yet.
We added a workaround that fixes a number of our test scenarios involving Storage connection limits. We’ll be absorbing the new change made in Storage 9.4.1, but it will require a little bit of refactoring before that can happen. If you have functions-specific scenarios that still don’t work, please file a separate issue over at https://github.com/Azure/azure-webjobs-sdk/issues, which the Functions team will look into.
As customers start taking advantage of
IHttpClientFactory
fromMicrosoft.Extensions.Http
, there will be a desire to delegate control over creatingHttpClient
instances to the application. For server applications, this is especially important so they can implement bulkheading, coordinate refreshing DNS changes, etc.Can we enable the application to plug in some
HttpClient
factory when creating aCloudBlobClient
?