Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you increase the number of threads used by .NET Remoting over TCP?

We are trying to increase the number of threads used by .NET Remoting over TCP. We have tried changing the ThreadPool.SetMinThreads, but our stress tests show that .NET Remoting can only handle about 100 concurrent requests. (However this is not a hard limit). In Task Manager, we can see our Remoting Server process Thread count grow from 11 to about 80, which then drops back down to 11 after the stress test. We are running an ASP.NET 4.0 application.

like image 770
meub Avatar asked Apr 03 '15 23:04

meub


2 Answers

To sum up. A remoting server is hosted by a windows service and a remoting client by IIS. To perfrom stress tests you use Apache Bench which calls the remoting client which calls the remoting server. You observe that no more than 100 concurrent requests is processed by the remoting server although you increase maximum number of threads in a thread pool on the remoting server.

If all what I said is true I think that one thing is missing here i.e. IIS also has a limit of threads that can be used to handle requests. You can send 1000 request from Apache Bench to the remoting client but only, for example 100 of them will be handled at the same time. I suspect that it might be a reason.

In order to increase number of threads for IIS I suggest you to try to:

  • Check configuration (see this question).
  • Try to use SetMinThreads on IIS.

The last comment from my side is that you have to remember that neither too small number of threads nor too high number of threads in a thread pool is good. Both situations can hurt performance.

like image 115
Michał Komorowski Avatar answered Oct 19 '22 12:10

Michał Komorowski


Are you sure the bottleneck is threads, and not network connections..? By default, .net has a fairly limited number of sockets available per remote IP. This applies to remoting, http (WCF, web service clients), etc.

You can override this under system.net/connectionManagement in your app config/web.config if this is what you are seeing, e.g.:

<configuration>
...
  <system.net>
    <connectionManagement>
      <add address="*" maxconnection="1000"/>
    </connectionManagement>
  </system.net>

More details about that config setting can be found here: https://msdn.microsoft.com/en-us/library/fb6y0fyc%28v=vs.110%29.aspx

like image 36
KristoferA Avatar answered Oct 19 '22 13:10

KristoferA