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?

3
  • What makes you think something needs to be "fixed"? Not being facetious... Feb 11, 2012 at 2:46
  • This is a case for serverfault, IMO.
    – Niklas B.
    Feb 11, 2012 at 3:02
  • I really do not think it is an IIS issue. A .NET client is restricted to two concurrent connections to a single host. This can be changed by using my answer below. Feb 11, 2012 at 5:46

2 Answers 2

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>
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

1
  • Omar, I am unclear. Does this setting affect outbound calls from the WCF service or to the WCF service? Feb 13, 2012 at 16:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .