Load balancing / Load Balancing Configuration Examples |
Internet Information Services (IIS) 7.x provides load balancing tools through IIS extensions.
The IIS extensions are:
Both tools are required to do the job.
The following examples show the resulting configuration entries. It can be done either by editing the configuration files manually or by using the IIS manager user interface. For more information on how to use the IIS manager user interface, see HTTP Load Balancing using Application Request Routing.
<configuration> ... <system.webServer> ... <rewrite> <globalRules> ... <rule name="ARR_GASFarm_loadbalance" enabled="true" patternSyntax="Wildcard" stopProcessing="true"> <match url="*" /> <conditions /> <action type="Rewrite" url="http://GASFarm/{R:0}" /> </rule> </globalRules> </rewrite> <proxy enabled="true" /> </system.webServer> ... <webFarms> ... <webFarm name="GASFarm" enabled="true"> <server address="GAS1.corporate.com" enabled="true"> <applicationRequestRouting weight="100" /> </server> <server address="GAS2.corporate.com" enabled="true"> <applicationRequestRouting weight="100" /> </server> <applicationRequestRouting> <loadBalancing algorithm="WeightedRoundRobin" /> <affinity useCookie="false" /> </applicationRequestRouting> </webFarm> </webFarms> ... </configuration>
For example, the http://localhost/ws/r/echo URL will be rewritten to http://GAS1.corporate.com/ws/r/echo, assuming that the GAS1.corporate.com server has been chosen.
<configuration> ... <system.webServer> ... <rewrite> <globalRules> ... <rule name="ARR_GASFarm_loadbalance" enabled="true" patternSyntax="Wildcard" stopProcessing="true"> <match url="*" /> <conditions /> <action type="Rewrite" url="http://GASFarm/{R:0}" /> </rule> </globalRules> </rewrite> <proxy enabled="true" /> </system.webServer> ... <webFarms> ... <webFarm name="GASFarm" enabled="true"> <server address="GAS1.corporate.com" enabled="true"> <applicationRequestRouting weight="100" /> </server> <server address="GAS2.corporate.com" enabled="true"> <applicationRequestRouting weight="100" /> </server> <applicationRequestRouting> <loadBalancing algorithm="WeightedRoundRobin" /> <affinity useCookie="true" /> </applicationRequestRouting> </webFarm> </webFarms> ... </configuration>
For example, the http://localhost/ua/r/gwc-demo URL will be rewritten to http://GAS1.corporate.com/ua/r/gwc-demo, assuming that the GAS1.corporate.com server has been chosen.