Shared Hosting Using Application Request Routing (ARR)

Using Application Request Routing (ARR) in a shared hosting environment introduces a new deployment architecture that provides additional benefits and opportunities for shared hosters. This scenario is enabled by a feature called host name affinity in Application Request Routing. For more information about the host name affinity feature and how it relates to shared hosting, refer to Shared hosting deployment using Application Request Routing.

This topic leads you through the steps to configure the host name affinity feature in Application Request Routing, as illustrated below:

Diagram representing the shared hosting environment in which A R R is deployed.

Goal

To configure Application Request Routing in a shared hosting environment.

Prerequisites

This walkthrough requires the following prerequisites:

  • IIS 7.0 or above on Windows 2008 (any SKU) or newer.

  • Microsoft Application Request Routing Version 1 and dependent modules.

  • Minimum of two application servers with working sites and applications.

    • The servers should be configured to use shared configuration and shared content. For more information about shared configuration, see the Shared Configuration article.
    • The sites on the servers should be using host name binding.

Follow the steps outlined in this document to install Application Request Routing.

As another prerequisite, you must define and configure a server farm by following the steps outlined in Define and Configure an Application Request Routing (ARR) Server Group.

Step 1 – Enable host name affinity

Before proceeding, ensure that the server farm was created with the application servers that are configured with shared configuration and shared content. The sites on the application servers should also be using host name binding.

To enable host name affinity using the UI

  1. Launch IIS Manager.

  2. Select the server farm that has been created for this walkthrough.

  3. The following icons are shown:

    Screenshot of the I I S Manager window showing the server farm icons.

  4. Double-click Server Affinity.

  5. To enable host name affinity, select Use host name, and then click Apply.

    Screenshot showing the Host Name Affinity dialog. Use host name is checked.

    Note that there are two providers for determining which server(s) the host name should be affinitized to. This is different from the load balance algorithm and the provider is only used for the host name affinity feature. The two providers are:

    • Microsoft.Web.Arr.HostNameRoundRobin
    • Microsoft.Web.Arr.HostNameMemory

    Microsoft.Web.Arr.HostNameRoundRobin tries to evenly distribute the number of affinitized host name in round robin. Using this provider has no requirements on the application servers.

    Microsoft.Web.Arr.HostNameMemory tries to distribute the number of affinitized host names based on the amount of available memory on the application servers where the server with the most amount of available memory would be assigned with the next host name. This provider uses WMI to query the available memory (defined as committed memory / physical memory). Therefore, the application servers must be Windows servers and additional configurations must be made on the application servers to allow remote WMI queries. Refer to How to configure WMI service on application servers for HostNameMemory affinity provider for more details.

    The time-out value is used to determine how long after the last request with the same host name the affinitization should be reset. This value should be set to the same value as the idle time-out value for the application pools on the application servers. By default, this value is 20 minutes.

  6. To verify this functionality, click Display Routing Table.

    Screenshot of the default View Routing Table dialog, no server addresses display.

  7. Type the name of the host, and then click Lookup by host name. The server address shown is the location to where the host name is affinitized.

To enable host name affinity using the command-line

  1. Open a command prompt with administrator privileges.

  2. Navigate to %windir%\system32\inetsrv.

  3. To enable host name affinity, enter (the below example uses myServerFarm as the name of the server farm):

    appcmd.exe set config  -section:webFarms /[name='myServerFarm'].applicationRequestRouting.affinity.useHostName:"True"  /commit:apphost
    

Step 2 - Specify the number of servers to use per host name

By default, all host names can use one application server. However, if the site owners want additional capacity, the hoster can specify the number of application servers that sites can use per host name.

To specify the number of servers to use using the UI

  1. On the Server Affinity page, click Advanced Settings.

    Screenshot of the default Advanced Settings dialog. The host name row is empty.

  2. In the Host Name column, type the host name. This field is required.

  3. In the Number of Allocated Servers column, type the number of servers that this host name can use.

  4. Alternate Host Names is an optional field that can be used to specify additional host names that should be treated the same way as the values in the Host Name column. For example, a site owner may have multiple DNS entries for the same site. In this case, he would want ARR to treat the multiple DNS entries the same way so that only one worker process starts on the application server for both domain names.

  5. To save changes, click OK.

  6. To verify this functionality, click Display Routing Table.

    Screenshot showing the unpopulated View Routing Table dialog.

  7. Type the name of the host, and then click Lookup by host name. The number of server addresses returned will be the same as what you specified for the Number of Allocated Servers. These are the servers to which the host name can be affinitized.

To specify the number of servers to use using the command-line

  1. Open a command prompt with administrator privileges.

  2. Navigate to %windir%\system32\inetsrv.

  3. To specify the number of servers per host name, enter (the following example uses myServerFarm as the name of the server farm, and sets the number of servers to 2 for the www.contoso.com host name):

    appcmd.exe set config  -section:webFarms /+"[name='myServerFarm'].applicationRequestRouting.affinity.[name='www.contoso.com',servers='2']" /commit:apphost
    

Summary

You have now successfully configured the host name affinity feature in Application Request Routing for a shared hosting scenario. For additional Application Request Routing properties and capabilities, refer to other Application Request Routing walkthroughs.