Web场和负载平衡环境中的WCF服务配置

时间:2010-10-21 10:29:02

标签: asp.net nettcpbinding web-farm nlb wcf

我想使用WCF服务[NetTcp](在c#中)为web-farm(用于网站)和NLB负载平衡(用于服务)配置ASP.NET网站项目。我想为它配置以下选项。

NetTcpBinding.maxConcurrentCalls,NetTcpBinding.ListenBacklog和NetTcpBinding.MaxConnections

注意:在单机配置期间,我将WCF服务项目中的NetTcpBinding.ListenBacklog和NetTcpBinding.MaxConnections的值更改为更多10,这是默认值。我有例外。当我在网站上更改此值时,它工作正常。因此,我必须保持默认配置。不知道为什么会这样。如果有人能够解释这一点,那将会很有帮助。

以下参考文章介绍了如何在给定环境中进行配置,但没有说明如何进行配置。

参考:http://msdn.microsoft.com/en-us/library/ee377061%28BTS.10%29.aspx

更新

让我简化一下。假设我有以下配置。

  • Web场中的2台IIS服务器。
  • NLB中的3个WCF服务服务器(NetTcp)
  • 默认配置。对于单个实例。
    • NetTcpBinding.ListenBacklog:10
    • NetTcpBinding.MaxConnections:10
    • NetTcpBinding.maxConcurrentCalls:16

现在,在此环境中我的配置设置是什么。它是否与上述相同或将如下。

  • 推荐配置。对于单个WebFarm / NLB
    • NetTcpBinding.ListenBacklog:30(10 * 3)
    • NetTcpBinding.MaxConnections:30(10 * 3)
    • NetTcpBinding.maxConcurrentCalls:48(16 * 3)

1 个答案:

答案 0 :(得分:0)

对于使用Windows NLB负载均衡net.tcp,您应该在MSDN中建议使用更短的leaseTimeout,值为30秒。确保使用每次通话服务。配置NLB以平衡每个端点的单个端口(如果您有多个端点)而不是端口范围,因为这会提高性能。确保未选中亲和关系 我使用了一个很好的自定义绑定,如下所示

<customBinding>

        <binding name="netTcpBindingConfiguration_custom"
                 closeTimeout="00:01:00"
                 openTimeout="00:01:00"
                 receiveTimeout="00:10:00"
                 sendTimeout="00:01:00" >
          <transactionFlow/>
          <windowsStreamSecurity/>
          <binaryMessageEncoding/>

          <tcpTransport maxBufferPoolSize="524288"
                        maxReceivedMessageSize="5000000"
                        connectionBufferSize="8192"
                        manualAddressing="false"
                        hostNameComparisonMode="StrongWildcard"
                        channelInitializationTimeout="00:00:05"
                        maxBufferSize="5000000"
                        maxPendingConnections="20"
                        maxOutputDelay="00:00:00.2000000"
                        maxPendingAccepts="5"
                        transferMode="Buffered"
                        listenBacklog="20"
                        portSharingEnabled="false"
                        teredoEnabled="false">
            <connectionPoolSettings groupName="default"
                                    leaseTimeout="00:00:30"
                                    idleTimeout="00:02:00"
                                    maxOutboundConnectionsPerEndpoint="100"/>
          </tcpTransport>
        </binding>
</customBinding>