Setting A Server Farm In IIS

Server Farm Concept

A group of servers working together to provide better functionality, reliability, and accessibility.

Load Balancer Concept

Is a device that distributes network traffic across a number of servers. This increases the capacity and reliability of applications.

https://miro.medium.com/max/1838/0*CCK15OF3DizmOITk

Application Request Routing(ARR)

IIS extension that enables the server to work as a load balancer.

Creating Server Farm In IIS

I created three VM’s within a Resource Group in Azure. Each VM has Windows Server 2019 and they all are within a Vnet. Installed IIS with just defaults on each VM.

  • IIS-Ad-Balancer
  • IIS-Ad-Serv1
  • IIS-Ad-Serv2

Note: For simplicity purposes in IIS of “IIS-Ad-Serv1” and “IIS-Ad-Serv2” stop the default website as it is using PORT 80 and we will be using it.

In “IIS-Ad-Serv1” I created a website in IIS called “MySite” with its own Application Pool: “MySiteAppPool”. In addition to this, for anonymous authentication, it is going to use the same “ApplicationPoolIdentity” instead of the “IUSR”.

The next step is to do a backup of IIS configuration. Remember we are doing this for consistency purposes. We want “IIS-Ad-Serv2” to be exactly the same as “IIS-Ad-Serv1”.

To create a backup, we need to run the following command:

> Backup-WebConfiguration -name <NAME>

> Backup folder location: “C:\Windows\System32\inetsrv”

Next, we are going to copy the whole “backup” folder and paste it under the same location but in “IIS-Ad-Serv2”. It is ok if you do not see any backup folder on the second VM, there should not be one.

Before restoring the backup in “IIS-Ad-Serv2” we need to do two things:

  1. Create the same Application Pool(“MySiteAppPool”) that we created in “IIS-Ad-Serv1” for the website.
  2. Copy and the website’s folder in “IIS-Ad-Serv1” and paste it in “IIS-Ad-Serv2”. It should be pasted under the same location as in “IIS-Ad-Serv1”. Folder (“my-site”) will be located at “C:\Sites” in both VM’s.

Note: Remember to stop the Default Website in the “IIS-Ad-Serv2” as well. Besides, although the content should be exactly the same, I am going to modify the content of the “index.html” in “IIS-Ad-Serv2” so we can identify which VM is which.

Having done that, we can proceed to restore the backup here in “IIS-Ad-Serv2”

> Restore-WebConfiguration -name <NAME>

And with this we should have the same website with the same configurations installed in both VM’s:

Enough work with these two. It is time for the fun part!

Start the “IIS-Ad-Balancer” VM.

In here download the Web Platform Installer

Once installed open IIS Manager and, at the server level open the “Web Platform Installer”, and search for “Application Request Routing 3.0” and install it.

Once installed you will see “Server Farms”, create a new “Server Farm” and give it a name.

Next, it is going to ask you for “Server address”. Where should the requests for this Public IP Address should actually go? Here we are going to put the IP addresses from “IIS-Ad-Serv1” and “IIS-Ad-Serv2”.

So, if a request comes to the public IP of the “IIS-Ad-Balancer”, this, with the help of “URL Rewrite” module(which got installed when it installed ARR) will send it to one of these IP’s.

After you click “Finish” it is going to ask you if it can configure the rule automatically. Click “Yes”!

You should be seeing this:

I am going to make two requests to the public IP of the “IIS-Ad-Balancer”. In this case, each VM part of the Server Farm has a 50% chance of receiving a given request.

Under the “Monitoring and Management” in our Server Farm, we can see some statistics.

Notice one request displays “Server 1” and the other request, made at most 10 seconds later, displays “Server 2”. This means ARR is working! ARR distributes requests evenly among the servers that conform the Server Farm.

If you have done all perfectly, you might think it is not working because the display is not changing. I assure you it is working, but most probably caching is enable. Eighter lower the memory cache duration or put “0"(testing purposes).

Recap

  • A Server Farm is a group of servers working together to provide better functionality, reliability, and accessibility.
  • A Load Balancer is a device that distributes network traffic across a number of servers. This increases the capacity and reliability of applications.
  • Application Request Routing(ARR) is an IIS extension that enables the server to work as a load balancer.
  • Web Platform Installer is needed in order to download this extension.

Resources

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

GAME CREDITS update — November 2020

Web scraping JavaScript sites and packaging them in FastAPI

Modern PHPDoc Annotations

Keycloak & Spring Boot

Apache BookKeeper Internals — Part 1 — High Level

Security in AWS — 2

Putting an AWS Service on a DNS domain apex

Scrape Google Scholar Case Law Results to CSV in Python and SerpApi

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adrian Jenkins

Adrian Jenkins

More from Medium

How to upgrade Zabbix Network Monitoring tools 5.4 from version 5.2/5.0

How to Solve Spatie/laravel-sitemap installation issue

Future Schedules API by Aviation Edge — JSON REST Schedule API

Jenkins Vs Teamcity CI Tool