本文介绍了理解负载均衡asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个网站,将开始使用负载平衡器和我试图环绕它我的头。

I'm writing a website that is going to start using a load balancer and I'm trying to wrap my head around it.


  1. IIS是否只是做所有的平衡你?

  2. 请您有分布式服务器不会发送到子服务器,如身份验证或其他工作之前,一些工作就坐在一个单独的Web层?

这似乎是很多我把阅读文章真的不给我一个直接的答案,还是我只是没有正确理解他们,我想我的头围绕如何真正的负载均衡从工作赵彤一面,如果任何人有任何code到共享也将是不错的。

It seems like a lot of the articles I keep reading don't really give me a straight answer, or I'm just not understanding them correctly, I'd like to get my head around how true load balancing works from a techincal side, and if anyone has any code to share that would also be nice.

我明白缓存会是一个问题,但是这是一个不同的主题,会议以及

I understand caching is gonna be a problem but that's a different topic, session as well.

推荐答案

IIS没有默认情况下,负载平衡器,但你可以使用至少两种Microsoft技术:

IIS do not have a load balancer by default but you can use at least two Microsoft technologies:


  • ,有你最好有一个独立的网络层做路由的工作,

  • 是集成了微软的Windows Server中,你可以加入现有的服务器到NLB群集。

  • Application Request Routing that integrates with IIS, there you should ideally have a separate web layer to do routing work,
  • Network Load Balancing that is integrated with Microsoft Windows Server, there you can join existing servers into NLB cluster.

这两项技术,不需要任何code的本身的,其基础设施的问题。但你必须,当然记得在开发过程中负载平衡的环境。例如,为了使网站真正平衡,他们应该是无状态的。否则,你就必须提供所谓的客户端和服务器之间的粘性的,所以相同的客户端将始终连接到同一台服务器。

Both of those technologies do not require any code per se, it a matter of the infrastructure. But you must of course remember about load balanced environment during development. For example, to make a web sites truly balanced, they should be stateless. Otherwise you will have to provide so called stickiness between client and the server, so the same client will be connecting always to the same server.

要进行业务无状态的,不要在服务器上,但场中的所有服务器之间共享外部服务器上坚持任何状态(会话,例如,在ASP.NET网站的情况下)。因此,它是常见的,例如使用外部(的StateServer或SQLServer的模式)对于集群中的所有站点。

To make service stateless, do not persist any state (Session, for example, in case of ASP.NET website) on the server but on external server shared between all servers in the farm. So it is common for example to use external ASP.NET Session server (StateServer or SQLServer modes) for all sites in the cluster.

编辑:

只是为了澄清有关这两种技术的提到的几件事,几句话:

Just to clarify a few things, a few words about both mentioned technologies:


  • NLB 网络层面的工作(如其实是一个网络驱动程序),所以无需使用有关应用程序的任何知识。您可以创建一个由几台计算机/服务器的所谓集群和揭露他们作为一个单一的IP地址。然后在另一台机器可以用这个IP作为任何其它的IP,但连接将被路由到集群的机器的自动之一。群集在每个服务器上配置的,没有外,其他路由的机器。根据集群设置,我们已经提到的,粘性可以启用或禁用(这里的无亲和调用)。还有一个加载重量参数,以便可以设置称重负载分配,发送到最快的机器,例如更多的连接。但是该参数是静态的,它不能被动态地根据网络,CPU或任何其它使用。事实上NLB不关心,如果目标应用程序即使在运行,它只是将网络流量路由到所选择的机器。但它注意到服务器下线去了,所以也就没有路由存在。 NLB的优点是,它是相当轻便的,不需要额外的机器。

  • ARR 的复杂得多,它内置的IIS上一个模块的目的是使在应用程序级的路由决策。网络负载均衡只是其功能之一,因为它是一个更完整,路由解决方案。它具有基于规则的路由,客户机和主机名的亲和力,HTTP服务器请求的负载均衡和分布式磁盘缓存作为微软的状态。创建有Server农场的像负载均衡算法,负载分配和客户粘性很多选择。您可以定义健康测试和路由规则转发请求到其他服务器。这一切的缺点是,应该是安装ARR专用机,所以它需要更多的资源(和成本)。

  • NLB &安培; ARR - 为使用单一ARR机可单一故障点,Microsoft国家的,这是值得考虑的创造ARR机器的NLB群集。

  • NLB works on network level (as a networking driver in fact), so without any knowledge about applications used. You create so called clusters consisting of a few machines/servers and expose them as a single IP address. Then another machine can use this IP as any other IP, but connections will be routed to the one of the cluster's machines automatically. A cluster is configured on each server, there is no external, additional routing machine. Depending on the clusters settings, as we have already mentioned, a stickiness can be enabled or disabled (called here a Single or None Affinity). There is also a Load weight parameter, so you can set weighed load distribution, sending more connections to the fastest machine for example. But this parameter is static, it can't be dynamically based on network, CPU or any other usage. In fact NLB does not care if target application is even running, it just route network traffic to the selected machine. But it notices servers went offline, so there will be no routing there. The advantages of NLB is that it is quite lightweight and requires no additional machines.
  • ARR is much more sophisticated, it is built as a module on top of IIS and is designed to make the routing decisions at application level. Network load balancing is only one of its features as it is a more complete, routing solution. It has "rule-based routing, client and host name affinity, load balancing of HTTP server requests, and distributed disk caching" as Microsoft states. You create there Server Farms with many options like load balance algorithm, load distribution and client stickiness. You can define health tests and routing rules to forward request to other servers. Disadvantage of all of it is that there should be a dedicated machine where ARR is installed, so it takes more resources (and costs).
  • NLB & ARR - as using a single ARR machine can be the single point of failure, Microsoft states that it is worth consideration to create a NLB cluster of ARR machines.

这篇关于理解负载均衡asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 01:54