IIS负载均衡ARR路由请求到ARR服务器和处理服务器

8/10/2015来源:ASP.NET技巧人气:4357

IIS负载均衡ARR路由请求到ARR服务器和处理服务器

.net web 使用IIS ARR(application Request Route)技术实现web的高性能、高可靠、易扩展及负载均衡。ARR的使用请参考 IIS负载均衡-Application Request Route详解

一般应用场景见下图所示,其中一台服务器只做ARR服务器,接受客户端发来的请求,根据配置的负载均衡算法,把请求转发给真正的请求处理服务器,如下图ServerFarm中的服务器B或C,由服务器B或服务器C来处理请求把处理结果返回给ARR服务器A,ARR服务器再把处理结果返回客户端。

我们的ARR服务器配置很好,只做ARR服务器有点浪费,为了实现高并发访问,我想ARR服务器做ARR服务的同时做应用程序服务器,即替ServerFarm中的服务器承担工作量。网上搜索了很多资料说是无法实现,但经我摸索通过配置url rewrite规则实现了我的需求。假定ARR服务器以80端口对外提供服务,ARR接收到80端口请求后,也会根据负载均衡规则转发请求给自己的8080端口上的web应用进行处理请求或者其他服务的8080端口上的web应用。实现大致步骤

1、ServerFarm中添加ARR服务器作为负载均衡服务器,注意端口

ipko7PvL21tW3++GPlqlWbVFXPHDx4CiE0dOivkyZNJxOLFyv++edfFha+1tZ0L6/I8eMnDh68ZO1a1S1bDnz22WeyJviaNVvnzl1mZeXX6wb2XxY2bwwGg/ko6cS8b960mzx5BkJozJiJenoOq1ZtVFLaMW7cZPKx97Jl644fv/HCvKMmTpzap8+PCKEFC1bu3fvnl1/+DyG0aZPK+vW7V6xQxubdu8LmjcFgMB8lnXSbW1szLl0yRAhNnDidSr3v7h7m4xO3b9+fCKGNG1V8fROcnALt7Dhbt6rOnr3466/79+8/EiEkLz97/frdfft+iRBavny9gsKWmTMX4GfevSts3hgMBvNR0ol5W1rSTp++hRDq33/AjBkLpk6dPX36/KFDf0UI/fjj0OnT548fL3/8+I0jRy5v2QQyaNB3gwcvXLdO7eDBk3369EUI7dypSfacKypuwy3v3lV3mXdrPRSW58VVxFGzH8QWPMjNeUBLj32Y1lxV2hP3JAaDwWDewOvM+8cfh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