Horia Toma
Horia Toma

Reputation: 1129

Service Fabric web service thread limit

I deployed a OWIN self hosted service (tried with Nancy, too) on a Service Fabric node and I configured the endpoint to be generated by the cluster, something that looks like this: 10.0.0.1:20018

From my tests, the maximum number of threads in the thread pool that can be used in parallel by the service to serve the requests is equal to 2 which represents the number of cores on the node machine (S2_V2)

I tried setting the number of threads using ThreadPool.SetMinThreads(100, 100) and it works perfectly fine when called locally, however it seems the hard limit of 2 is always enforced for external clients, even if they are deployed on some other nodes of the cluster.

Is there any way to increment the number of threads in the thread pool for the Service Fabric node endpoints?

Upvotes: 2

Views: 1203

Answers (1)

Amir
Amir

Reputation: 347

I think that you also need to set up DefaultConnectionLimit as such:

ServicePointManager.DefaultConnectionLimit = 20000;

You can stick this in your Main() method.

See https://learn.microsoft.com/en-us/dotnet/api/system.net.servicepointmanager.defaultconnectionlimit?view=netframework-4.7.2 for more info

Upvotes: 0

Related Questions