Internet is one of the greatest invention of 21st century.
More than 54% of world’s population usage internet.
Sites receiving unprecedented workload.
google.com (113,533,299 hits/day), youtube.com (104,337,118 hits/day), facebook.com(88,347,439 hits/day), are top searched sites according to Amazon's traffic rating.
Above all are having multiple data centers and Web Servers to fulfill all requests.
What is Load Balance?
1. Load Balancing refers to efficiently distributing incoming network traffic across a group of backend servers.
2. Load balancing is a key component of highly-available infrastructures.
3. commonly used to improve the performance and reliability of web sites, applications, databases and other services by distributing the workload across multiple servers.
Why Load Balance is required for Web Servers?
Modern high-traffic websites must serve hundreds of thousands concurrent requests from users
or clients and return the correct text, images, video, or application data, all in a fast and reliable
manner. To cost-effectively scale to meet these high volumes, modern computing best practice
generally requires adding more servers.
In this manner, a load balancer performs the following functions:
- Distributes client requests or network load efficiently across multiple servers.
- Ensures high availability and reliability by sending requests only to servers that are online.
- Provides the flexibility to add or subtract servers as demand dictates.
How Load Balance works for Web Servers?
- In a basic load balancing setup, clients send their requests to the IP address of a virtual server.
- The virtual server distributes them to the load-balanced application servers according to a preset pattern, called the load balancing algorithm.
How Load Balance works for Web Servers?
- In the example illustrated above, the user accesses the load balancer, which forwards the user's request to a backend server, which then responds directly to the user's request.
- In this scenario, the single point of failure is now the load balancer itself.
- This can be mitigated by introducing a second load balancer, but before we discuss that, let's explore how load balancers work.
How does the load balancer choose the backend server?
Load balancers choose which server to forward a request to based on a combination of two factors :
- Health Checks
- Load Balancing Algorithms
Health Checks :
- Load balancers should only forward traffic to "healthy" backend servers.
- It regularly attempt to connect to backend servers using the protocol and port defined by the forwarding rules to ensure that servers are listening.
- it automatically remove unhealthy servers from the pool, and traffic will not be forwarded to it.
Load Balancing Algorithms:
- Round Robin- servers will be selected sequentially.
- Least Connections - Load balancer will select the server with the least connections.
- Source - This method ensures that a particular user will consistently connect to the same server.
Load Balance in IIS Servers
- Set-Up Application Request Routing Module.
- Set-Up a Web farm of Web Servers.
Application Request Routing Module :
- It is a proxy-based routing module that forwards HTTP requests to application servers based on HTTP headers, server variables, and load balance algorithms.
- ARR Version 2 works with IIS 7 and Above.
Installation Steps & Package Info :
ARR Module Package contains following
- Microsoft URL Rewrite Module for IIS.
- Microsoft Web Farm Management Version 1 for IIS.
- Microsoft Application Request Routing Version 1 for IIS.
- Microsoft External Cache Version 1 for IIS.
URL Rewrite Module :
- Step 1 - Download Microsoft Application Request Routing Version 2 .
- Step 2 - Install Microsoft Application Request Routing Version 2.
- Step 3 - Change application pool process model for Application Request Routing.
- Step 4 - Change application pool recycling settings for Application Request Routing.
it comes with ARR Module package.
- It is used to create powerful customized rules to map request URLs to friendly URLs. We can use the URL Rewrite module to perform URL manipulation tasks.
- Perform redirects, send custom responses, or stop HTTP requests based on the logic expressed in the rewrite rules.
- Control access to Web site content based on URL segments or request metadata.
- A rewrite rule defines the logic of what to compare or match the request URL with, and what to do if the comparison is successful.
Rewrite rules consists of the following parts:
Set-Up a web farm of web servers :
- If URL does not match, the URL Rewrite Module immediately stops processing that rule, and goes on to the next rule.
- If a pattern matches and there are no conditions for the rule, the URL Rewrite Module performs the action specified for this rule
- If a pattern matches and there are conditions for the rule, the URL Rewrite Module evaluates the conditions. If the evaluation is successful, the specified rule action is performed.
there are multiple steps to develop a web farms.
IIS Web Farm Infrastructure :
There are many ways to design the infrastructure of a web farm.
in Local Content Infrastructure , each web server needs to store content locally.
in Shared Network Content Infrastructure , content configures all web servers point to a central location.
IIS Web Farm Configuration :
determine what is needed to configure shared content and shared configuration.
Shared configuration is an IIS feature that helps support homogeneous web farms where all web servers share the same configuration. You enable shared configuration in two steps by using the IIS Manager.
Set up a shared folder on file server and create user or user group who can access that content.
- Export the configuration files to a shared folder on the back-end file server.
- Point IIS to the UNC path for that shared folder.
- Plan a Load Balancer : ARR is used for load balancing.
- A key feature of ARR is called host name affinity. Host name affinity creates an affinity (close connection) between requests and a given server (or set of servers).
- This ensures that a given site is consuming resources only on a defined number of servers.
- Prepare a list of IP addresses for all servers in your farm.
- Other features can be enabled as per requirements.