Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Feb 11 '12 at 5:15

This question came from our site for professional and enthusiast programmers.

    
What makes you think something needs to be "fixed"? Not being facetious... –  Andrew Barber Feb 11 '12 at 2:46
    
This is a case for serverfault, IMO. –  Niklas B. Feb 11 '12 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. –  Phil Bolduc Feb 11 '12 at 5:46

2 Answers 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>
share|improve this answer

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

share|improve this answer
    
Omar, I am unclear. Does this setting affect outbound calls from the WCF service or to the WCF service? –  AngryHacker Feb 13 '12 at 16:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.