I am using a single instance of System.Net.Http.HttpClient to send requests from a windows service to multiple RESTful API's.
I ran into a strange issue where some of the HTTP requests are timing out at more or less regular intervals. I get lots of timeout somewhere every 45 - 60 minutes.
Here is the frequency of such timeouts.
Here is how I create a HttpClient,
ServicePointManager.DefaultConnectionLimit = 100;
_client = new HttpClient(new HttpClientHandler
{
UseProxy = false,
Proxy = null
});
_client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
The DefaultConnectinoLimit was increased after some requests timing out. Should this be increased further or is there an optimal value that I can use ?
Is there anything else that could be causing this problem ?
Any thoughts or suggestions on this is hugely appreciated.
NOTE: I am running 100 threads and using SendAsync calls on those.