Shared Hosting Using Application Request Routing (ARR)
by IIS Team
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:
To configure Application Request Routing in a shared hosting environment.
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, refer to this article.
- The sites on the servers should be using host name binding.
If the Application Request Routing RC has not been installed, download it at:
- Download Microsoft Application Request Routing Version 1 for IIS 7 (x86) here.
- Download Microsoft Application Request Routing Version 1 for IIS 7 (x64) here.
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:
Launch IIS Manager.
Select the server farm that has been created for this walkthrough.
The following icons are shown:
Double-click Server Affinity.
To enable host name affinity, select Use host name, and then click Apply.
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 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 configuraions 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.
- To verify this functionality, click Display Routing Table.
- 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:
Open a command prompt with administrator privileges.
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:
- On the Server Affinity page, click Advanced Settings.
In the Host Name column, type the host name. This field is required.
In the Number of Allocated Servers column, type the number of servers that this host name can use.
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.
To save changes, click OK.
To verify this functionality, click Display Routing Table.
- 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:
Open a command prompt with administrator privileges.
To specify the number of servers per host name, enter (the below 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
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.