WCF服务配置在网络农场和负载平衡设想中
-
10-10-2019 - |
题
我想使用WCF Service [NetTCP](在C#中)配置ASP.NET网站项目,用于Web-Farm(用于网站)和NLB负载平衡(用于服务)。我想为同一配置以下选项。
nettcpbinding.maxconcurrentcalls,nettcpbinding.listenbacklog和nettcpbinding.maxconnections
注意:在单个计算机配置期间,当我更改NetTcpBinding.listenbacklog和nettcpbinding.maxconnections时,WCF服务项目中的MaxConnections将其更改为10,这是默认值。我有例外。当我在网站上更改此值时,它运行良好。因此,我必须保持默认配置。不确定为什么是这种情况。如果有人能解释这一点,那将是有帮助的。
以下引用给出了如何在给定环境中配置的想法,但不告诉如何进行操作。
参考: http://msdn.microsoft.com/en-us/library/ee3777061%28bts.10%29.aspx
更新:
让我简化一点。可以说我有以下配置。
- 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)
解决方案
对于使用Windows NLB的负载平衡net.tcp,您应该有一个较短的牵引时间,并建议在30秒 MSDN. 。确保您使用每个呼叫服务。配置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>
不隶属于 StackOverflow