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

The following example shows how to configure IIS 7.x to do load balancing for sessionless requests. It assumes the architecture illustrated by the sample architecture 1.
<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.

Session-bound requests

The following example shows how to configure IIS 7.x to do load balancing for session-bound requests. It assumes the architecture illustrated by the sample architecture 1. The example illustrates cookie-based 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="true" />
      </applicationRequestRouting>
    </webFarm>
  </webFarms>
  ...
</configuration>  

For example, the http://localhost/wa/r/gwc-demo URL will be rewritten to http://GAS1.corporate.com/wa/r/gwc-demo, assuming that the GAS1.corporate.com server has been chosen.