ServicePoint Configuration - Application starving http connections?

156 views Asked by At

I have two C# asp.net applications running on IIS: The main application creates up to 80 threads where each of them will establish an http connection to a certrain endpoint (all the same endpoint (LAN)) at a frequency of roughly 3 seconds. That endpoint is beeing hosted on localhost (e.g localhost:4510). This endpoint is the second application which represents the "driver" that will ultimately establish a connection to a device within LAN. So it's totally possible to have 80 threads trying to make a request to driver/device at the same time.

Over time the app seems to have issues with anything involving httpclients. RavenDB, Elasticsearch and also the 80 threads. I read a few things about ServicePointManager class; especially DefaultConnectionLimit and MaxServicePoints and how the influence http througput. I only have basic understanding of the underlying mechanism so I'd like to ask if I should focus on a specific subject or what I would want to check to may improve on http throughput.

Update: With current configuration CPU load is low and memory consumption also. Following code shows how the 80 httpclients which connect to the driver on localhost:4510:

var driverBaseAddressSp= ServicePointManager.FindServicePoint(driverBaseAddress);                               Debug.WriteLine(driverBaseAddressSp.ConnectionLimit);
Debug.WriteLine(driverBaseAddressSp.MaxIdleTime);
var connectionUriSp = ServicePointManager.FindServicePoint(connectionUri);
Debug.WriteLine(connectionUriSp.ConnectionLimit);
Debug.WriteLine(connectionUriSp.MaxIdleTime);
return new HttpClient { BaseAddress = driverBaseAddress }; 

ConnectionLimit shows Int.Max when debugging but I cannot find any configuration in the solution?

0

There are 0 answers