-
Notifications
You must be signed in to change notification settings - Fork 2
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
HttpClient does't respect DNS changes #28
Comments
Hi, what specific reproducible problem did you encounter (if any)? |
I will need to think how to simulate DNS change... quite tricky |
I wonder why you wanna do such a complicated thing. Its no need in practice (on production system) by that. Maybe I don't see any usecase and you have one, but I'm although not sure where is the need for this client. |
I had a deeper look and I guess we're using it a good way: Where is the value of using the Factory if we just need ONE client? |
I am afraid that hosting app in cloud with high resilliency requirement can expose some troubles. |
Maybe this ist the problem with sockets when using the HttpClient parallel: https://makolyte.com/csharp-how-to-make-concurrent-requests-with-httpclient/ |
hi
as described in article
https://josef.codes/you-are-probably-still-using-httpclient-wrong-and-it-is-destabilizing-your-software/
"
The original and well-known HttpClient class can be easily used, but in some cases, it isn't being properly used by many developers.
As a first issue, while this class is disposable, using it with the using statement is not the best choice because even when you dispose HttpClient object, the underlying socket is not immediately released and can cause a serious issue named ‘sockets exhaustion’.
Therefore, HttpClient is intended to be instantiated once and reused throughout the life of an application. Instantiating an HttpClient class for every request will exhaust the number of sockets available under heavy loads. That issue will result in SocketException errors. Possible approaches to solve that problem are based on the creation of the HttpClient object as singleton or static.
But there’s a second issue with HttpClient that you can have when you use it as singleton or static object. In this case, a singleton or static HttpClient doesn't respect DNS changes.
To address those mentioned issues and make the management of HttpClient instances easier, .NET Core 2.1 introduced a new HttpClientFactory...
"
do you think that introducing HttpClientFactory will be valuable?
do you accept pull requests? ;)
The text was updated successfully, but these errors were encountered: