Microsoft Application Request Routing (ARR) is a proxy-based
routing module that forwards HTTP requests to application servers based on HTTP
headers, server variables, and load balance algorithms. With ARR you can
increase application availability and scalability by better utilization of
content server resources with lower management cost by creating opportunities for
shared hosting environments.
ARR relies on the URL rewrite module to inspect incoming
HTTP requests to make the routing decisions. Therefore, the URL rewrite module
is required to enable ARR features. Using ARR in a shared hosting environment
introduces a new deployment architecture that provides additional benefits and opportunities
for shared hosting. This scenario is enabled by a feature called host name affinity.
The host name affinity feature in Application Request Routing enables shared hosting
to rethink how sites are deployed. Application Request Routing affinitizes the
requests, regardless of whether they are made from one client or multiple
clients, to one server behind ARR, ensuring that a given site is consuming
resources only on one of the servers.
For e.g. in the diagram the ARR load balances the request to
one of the server and affinitizes the request for a DNS to the same server for
the lifespan of corresponding worker process. Requests are sent to one of the
server and responses are returned for the request. As you can see the load
balancing is dynamically taken care by ARR which will help the administrators
to scale the environment horizontally by adding new servers without predefined
site allocations, by the flexibility of managing the shared configuration in a
single place.
In this post we'll see how we can configure ARR in a shared
hosting environment and thus make use of the features for a zero downtime
deployment scenario when doing CD in your organization.
The first step is to create a server farm with the
application servers that are configured with shared configuration and content.
The sites on the application server should be using host name binding as follows:
- Open server affinity from the server farm in ISS.
- Enable host name affinity by using the host name and click Apply.
- 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.
- Click on Apply from the Actions on right side to save the changes
- Next to specify the number of servers to be used per host name, Select Advanced settings in the Server Affinity page and enter values for the host name and number of allocated servers.
- Click OK to save the changes. Now you have successfully configured the host name affinity feature in ARR for a shared hosting scenario. SSL offloading is enabled by default in the Routing rules section. You can disable this and thus make all communications to be encrypted between servers. To disable SSL offloading uncheck the Enable SSL offloading checkbox in the Routing rules page.
- To setup your website for zero downtime requirement, first you need to create an ARR site where the users connect to. To create an ARR site, create an empty website in ISS and put it in its own application pool and set the non-timeout requirements on the app pool.
- Create two websites that will actually host the content. Make sure that these sites have a different IP address and on a different port than the ARR site. Assign these sites to their own application pools and use different virtual directories for the content.
- On the server farm that was configured in step 1, add the servers create and change the http port to the port of the websites in the advanced settings as given below.
- In the IIS manager, open URL rewrite rules and click on the ARR rule created for your configuration
- Add a new condition for the {SERVER_PORT} does not match
<
> and click on OK. Apply your changes to the server.
- That completes the configuration for ARR and URL redirect for your website from the ARR site. You can now use this configuration to deploy a new version of your application to the severs by drain stopping one of them and then warm-up the offline site after deployment by using the alternate IP address. Repeat the process for the second server and then complete the deployment process without a downtime.
No comments:
Post a Comment