Internet Information Services 7.x
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.
Sessionless requests
<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>- These configuration entries can be put at the server level in the applicationHost.config file.
- In the globalRules section of the rewrite section, the rule named
ARR_GASFarm_loadbalancetells the module to rewrite all incoming requests so that they are routed to theGASFarmweb farm. - The proxy is enabled in order to forward the requests to the two GAS servers.
- The web farm named
GASFarmis declared with the two GAS servers.
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.
Session-bound requests
<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> - These configuration entries can be put at the server level in the applicationHost.config file.
- In the globalRules section of the rewrite section, the rule named
ARR_GASFarm_loadbalancetells the module to rewrite all incoming requests so that they are routed to theGASFarmweb farm. - The proxy is enabled in order to forward the requests to the two GAS servers.
- The web farm named
GASFarmis declared with the two GAS servers. - The
useCookieattribute of theaffinityelement is set to true; actually, this is the only difference compared to the sessionless request routing.
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.