【问题标题】:WCF Service configuration in Web Farm and Load Balancing envrionmentWeb 场和负载平衡环境中的 WCF 服务配置
【发布时间】:2011-04-28 12:57:10
【问题描述】:

我想为 web-farm(用于网站)和 NLB 负载平衡(用于服务)使用 WCF Service[NetTcp](均在 c# 中)配置 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 Farm 中有 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)

【问题讨论】:

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


    【解决方案1】:

    对于使用 Windows NLB 的 net.tcp 负载平衡,您应该有一个更短的租约超时时间,MSDN 中建议的值为 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>
    

    【讨论】:

    • 感谢您尝试这些设置并通知您。你能告诉我在 WCF 设置中更改 NetTcpBinding.ListenBacklog 和 NetTcpBinding.MaxConnections 值时遇到的异常吗?
    猜你喜欢
    • 2011-12-27
    • 2015-04-01
    • 2020-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多