user758977
user758977

Reputation: 441

WCF connection limits

We have a WCF net.tcp service in high traffic site. http://www.artedelcorpo.com/

It works very well for some time, then it stops and returns a timeout error. When I restart IIS, it runs again.

Why? Is there a limit on connections?

Upvotes: 7

Views: 26564

Answers (2)

Tim
Tim

Reputation: 28530

There is a default setting of 10 connections for the NetTcp Binding. You can increase this in the <binding> section of your config. The same is true of the timeouts - the default is 1 minute, but you can also adjust the close timeout, open timeout, receive timeout and send timeout.

<system.serviceModel>
    <bindings>
        <netTcpBinding>
            <binding name="MyNetTcpBinding" closeTimeout="00:05:00"
                     openTimeout="00:05:00" receiveTimeout="00:05:00"
                     sendTimeout="00:05:00" maxConnections="100" />
        <netTcpBinding>
    </bindings>
</system.serviceModel>

The above sample will set the timeouts to 5 minutes and the max connections to 100.

See <netTcpBinding> for more detail/information.

Upvotes: 11

ErnieL
ErnieL

Reputation: 5801

Increasing network timeouts buys you time for the request to be processed. This can help you survive a short burst of high traffic, but it doesn't change your system throughput.

If your hardware still has some headroom in terms of memory and CPU when these problems occur, you should look at changing your concurrency throttles. This will allow more requests to be processed in parallel. The default throttle values in .NET 3.5 are actually quite conservative and this might be a quick fix (depending on your service architecture).

Here's some good examples of configuring WCF service throttles.

If your hardware is maxed out and you are still getting timeouts, its probably time to cluster the service and add another node.

Upvotes: 5

Related Questions