0

We have an ASP MVC Application targetting .Net Framework 4.7 that make Http requests using HttpClient to another ASP service of ours. Both are hosted in IIS on the same server. We reuse the HttpClient instance for all requests and can make many concurrent requests.

There seems to be something that limits this request, I have checked the Web Service Current Connections performance counter for the receiving server and never goes above 16 connections when running on our Windows Server 2012 R2 server and 17 connections on my Windows 10 development computer.

This means that when there are more than 16/17 requests concurrently, they are queued. Even multiple users on our site are collectively limited to 16/17 concurrent requests by the HttpClient.

My testing seems to suggest that is the HttpClient that is forcing this limit as when I changed to make a new HttpClient object per request then the number of current connections increases to match the number of requests I make. This isn't a viable option due the overhead of new connections though.

I keep finding that ServicePointManager.DefaultConnectionLimit is the setting that limits this but even set to Int32.MaxValue I still hit the limit of 16/17 connections. I set it to 10 and got 10 connections. I set it to 100 and get 17. What else is limiting the connections? If I can't change it, can I find out what the limit will be and make more HttpClient objects when I hit it?

A Jackson
  • 2,776
  • 7
  • 34
  • 45
  • I saw that before...maybe this article can help you https://aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/ – Hackerman Feb 12 '20 at 15:41
  • Maybe, you could read this : https://stackoverflow.com/questions/16194054/is-async-httpclient-from-net-4-5-a-bad-choice-for-intensive-load-applications – Bioukh Feb 12 '20 at 15:42

0 Answers0