1

I have a WCF service (written in .NET 4) running under IIS 7.5 on Windows 2008 R2 64-bit.

I created a test tool that spawns 10-20 (or more) threads - each thread creates a random payload and hits the server. On the server, I log all the accesses and I can see the thread IDs that are engaged in IIS.

Regardless of how many client requests hit the server (at the same time), the server only uses 2 threads. It basically cycles between them.

But then, out of the blue, IIS will start using as many threads as the number of requests that I throw at it. And then later it will drop down to using 1 or 2 threads.

Can someone explain this behavior and what I can do to fix it?

AngryHacker
  • 2,877
  • 6
  • 32
  • 33

2 Answers2

2

How about adjusting the client connection management settings,

<configuration>
  <system.net>
    <connectionManagement>
      <add address = "http://www.example.org" maxconnection = "4" />
      <add address = "*" maxconnection = "2" />
    </connectionManagement>
  </system.net>
</configuration>
Phil Bolduc
  • 151
  • 2
2

You are definitely hitting the system.net default 2 connection limit. So, you need to increase the maxConnection allowed per IP to the number of threads.

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

If you have Windows 7, then you will hit the max 25 request limit on IIS. You will have to load test on Windows 2008 to get the real number.

Another thing is the client may not be executing all the threads in parallel. So, you need to make sure the client is really running all 100 threads in parallel.

Besides these settings, in order to scale up WCF, you need to do some further tweaking. The most common tweaks are explained here:

http://www.codeproject.com/Articles/133738/Quick-Ways-to-Boost-Performance-and-Scalability-of

oazabir
  • 405
  • 1
  • 5
  • 8