网络负载平衡(NLB):是否适合“有状态”网络ASP.NET 应用程序?
我发布了以下有关 ASP.NET Web Farm 的问题。
建议使用网络负载平衡 (NLB) 作为创建网络场的主要方式。
然而,Wikipedia 表示“NLBS 旨在用于……无状态应用程序”。然而,我们的网络应用程序绝对是“有状态的”:它是一个封闭的网站,用户可以通过登录名和密码访问,每个用户的信息都不同:人们会看到自己的交易和操作。
在这种情况下,我们是否仍应使用 NLB?
谢谢。
I have posted the following question concerning ASP.NET web farms.
How to create an ASP.NET web farm?
Guys recommended using Network Load Balancing (NLB) as a primary way of creating a web farm.
However, Wikipedia says that "NLBS is intended for ... stateless applications". Our web application, however, is absolutely "stateful": it is a closed site to which users will have access by login and password, and information for every user will be different: people will see their own trades and operations.
Should we still use NLB in this scenario?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您遵循指南,就没有理由不这样做。
Web 应用程序本质上是无状态的,因此即使您的用户应该登录,它也不会使应用程序成为有状态的。
ASP.NET 中有状态的事物包括:
,可以在 WebFarm 中进行适当配置。
以下是有关如何配置 NLB 的示例。
Do not see reasons why not if you follow the guidelines.
The web application is by nature stateless, so even if your users should log-in it does not make the application stateful.
Couple the things which ARE stateful in ASP.NET are:
which can be configured appropriately in a WebFarm.
Here is an example on how to configure the NLB.
您仍然可以使用 NLB,但您需要一个支持粘性会话的 NLB,这意味着它始终将流量从某个客户端路由到同一 Web 服务器。就负载平衡而言,这不是最好的解决方案,但至少允许您扩展到多个服务器。
You can still use a NLB, but you need one that supports Sticky Sessions, meaning that it will always route traffic from a certain client to the same web server. Not the best solution in terms of load balancing, but at least allows you to grow to multiple servers.
我认为负载均衡还是可取的。您只需对其进行设置,以便会话“粘性”:会话打开后:
http://technet.microsoft.com/en-us/library/bb734910.aspx
I think load balancing is still desirable. You just need to set it up so sessions are "sticky": once a session is open:
http://technet.microsoft.com/en-us/library/bb734910.aspx
绝对是的。您可以采用一些策略来维护场中服务器之间的状态。对于场中的所有 Web 服务器,machineKey 设置应该相同,以便身份验证票证在计算机之间有效。
http://msdn.microsoft.com/en-us/library/ ms998288.aspx#paght000007_webfarmdeploymentconsiderations
有几个选项可用于管理 Web 服务器之间的会话状态:
http://msdn.microsoft.com/en-us/library/z1hkazw7.aspx
http://support.microsoft.com/kb/311209
Absolutely, yes. There are strategies you can employ to maintain state between servers in your farm. The machineKey settings should be the same for all webservers in your farm so that auth tickets are valid between machines.
http://msdn.microsoft.com/en-us/library/ms998288.aspx#paght000007_webfarmdeploymentconsiderations
There are a few options for managing session state between your webservers:
http://msdn.microsoft.com/en-us/library/z1hkazw7.aspx
http://support.microsoft.com/kb/311209