2
votes

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?

1
Are you using Kestrel or WebListener?Kiryl Z
hi @KirylZ, Web Api self hosted, but we have the same problem when deploying a Nancy listenerHoria Toma
So... by "I deployed a OWIN self hosted service (tried with Nancy, too) on a Service Fabric node" you mean that you've deployed self-hosted service on its own rather than as a service of SF app?Kiryl Z
no, it's an exe packed with the necessary xml config files and deployed to SF, therefore managed by SFHoria Toma
Ok then, I'm curious if you tried to set MaximumConnectionCount for Nancy Host configuration?Kiryl Z

1 Answers

0
votes

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://docs.microsoft.com/en-us/dotnet/api/system.net.servicepointmanager.defaultconnectionlimit?view=netframework-4.7.2 for more info