Web Farm 和负载平衡环境中的 WCF 服务配置
我想使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于使用 Windows NLB 的负载平衡 net.tcp,您应该使用较短的leaseTimeout,其值建议为 30 秒 MSDN。确保您使用按呼叫服务。配置 NLB 以平衡每个端点的单个端口(如果您有多个端点)而不是端口范围,因为这可以提高性能。确保未选中关联性。
我使用了一个自定义绑定,效果很好,如下所示
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