• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1425
  • Last Modified:

WCF Service hangs under heavy load

For some reason my WCF service stops responding when a lot of people start hitting it. I have checked the memory consumption and it is very low. It's a simple call that doesn't use many resources. It justs seems to stop without warning at maybe 30 users.
0
johnchapmansc
Asked:
johnchapmansc
  • 7
  • 5
1 Solution
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Hello, can you give more information? what kind of operations you do inside your web method? connections to DB? file access? network access? have you checked the CPU usage when it start to hang?
0
 
johnchapmanscAuthor Commented:
I'm echoing a string and there are no db connections. CPU is low.
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Ok, then probably the problem is a network level, where is hosted your service? IIS6? IIS7? also what .net framework version are you using?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
johnchapmanscAuthor Commented:
It is hosted in IIS7, .NET4
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Ok, maybe your problem is caused for a bad implementation on your proxy client, maybe your clients are not closing the connection to your service, can you show me your <bindings> section of your service web.config file?

Also this article can help you to change the defaults settings of your TcpBinding:
http://msdn.microsoft.com/en-us/library/ee377061(v=bts.10).aspx

I think that you can test by lowering the inactivityTimeout value.
0
 
johnchapmanscAuthor Commented:
Here is my config file:
<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="SimpleService.SimpleSvc" behaviorConfiguration="mdb">
        <endpoint address="http://localhost:2345/Simple/query" binding="basicHttpBinding"
                contract="SimpleService.ISimpleService"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="mdb">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="nb"
                 maxConnections="20"
                 maxBufferPoolSize="2566"
                 sendTimeout="10"
                 transactionFlow="false">
          <readerQuotas maxBytesPerRead="6500"/>
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Hello the is your problem I think:
    <bindings>
      <netTcpBinding>
        <binding name="nb"
                 maxConnections="20"
                 maxBufferPoolSize="2566"
                 sendTimeout="10"
                 transactionFlow="false">
          <readerQuotas maxBytesPerRead="6500"/>
        </binding>
      </netTcpBinding>
    </bindings>

Try this new config:
<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="SimpleService.SimpleSvc" behaviorConfiguration="mdb">
        <endpoint address="http://localhost:2345/Simple/query" binding="basicHttpBinding"
                contract="SimpleService.ISimpleService"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="mdb">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="nb" transactionFlow="false">
          <readerQuotas maxBytesPerRead="6500"/>
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

Open in new window

0
 
johnchapmanscAuthor Commented:
That was it. Thanks so much.
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
No, sorry, try this instead:
<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="SimpleService.SimpleSvc" behaviorConfiguration="mdb">
        <endpoint address="http://localhost:2345/Simple/query" binding="basicHttpBinding"
                contract="SimpleService.ISimpleService"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="mdb">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="nb" transactionFlow="false" maxConnections="200">
          <readerQuotas maxBytesPerRead="6500"/>
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>

Open in new window

0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Sure? the docs says that the default value of maxConnections is 10, in the last config i'm setting this to 200.
Reference:
http://msdn.microsoft.com/en-us/library/ms731343.aspx
0
 
johnchapmanscAuthor Commented:
Yes, the problem was the maxConnections.
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Nice Ok!, glad to help!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 7
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now