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

发布于 2024-09-28 07:19:03 字数 1118 浏览 9 评论 0原文

我想使用 WCF 服务[NetTcp](均在 c# 中)为网络场(用于网站)和 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 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)

I want to configure ASP.NET Website Project using WCF Service[NetTcp] (both in c#) for web-farm (for website) and NLB Load balancing (for service). I would like to configure following options for same.

NetTcpBinding.maxConcurrentCalls, NetTcpBinding.ListenBacklog and NetTcpBinding.MaxConnections

Note: During single machine configuration when I changed value of NetTcpBinding.ListenBacklog and NetTcpBinding.MaxConnections in WCF Service project to more that 10, which is default value. I got exception. When I changed this value in Website it was working fine. Due to this I had to keep in default configuration. Not sure why this is the case. If anyone could explain this it would be helpful.

Following reference gives idea how to configure in given environment but does not tell how to go about it.

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

Update:

Let me simplify a bit. Lets say I have following configuration.

  • 2 IIS servers in Web Farm.
  • 3 WCF Service Servers (NetTcp) in NLB
  • Default config. for single instance.
    • NetTcpBinding.ListenBacklog: 10
    • NetTcpBinding.MaxConnections: 10
    • NetTcpBinding.maxConcurrentCalls: 16

Now what will be my configuration setting in this environment. Will it be same as above or will be as follows.

  • Suggested config. for single WebFarm/NLB
    • NetTcpBinding.ListenBacklog: 30 (10*3)
    • NetTcpBinding.MaxConnections: 30 (10*3)
    • NetTcpBinding.maxConcurrentCalls: 48 (16*3)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

儭儭莪哋寶赑 2024-10-05 07:19:03

对于使用 Windows NLB 的负载平衡 net.tcp,您应该使用较短的leaseTimeout,其值建议为 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>

For load balancing net.tcp using Windows NLB you should have a shorter leaseTimeout with a value of 30 sec being suggested in MSDN. Make sure you use per call services. Configure NLB to balance individual port for each endpoint (if you have multiple endpoints) rather than port range as this increases performance. Make sure that affinity is unchecked.
I use a custom binding that has served me well as shown below

<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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文