Client Based Load Balancing
It might be easier to make the client code and resources highly available and scalable than to do so for the servers; serving non-dynamic content requires fewer server resources. Before going into the details, let us consider a desktop application that needs to connect to servers on the internet to retrieve data. If our theoretical desktop application generates more requests to the remote server than it can handle, we will need a load balancing solution.
Instead of letting the client know of only one server from which to retrieve data, we can provide many servers—s1.mywebsite.com, s2.mywebsite.com, and so on. The desktop client randomly selects a server and attempts to retrieve data. If the server is not available, or does not respond in a preset time period, the client can select another server until the data is retrieved. Unlike web applications—which store the client code (JavaScript code or Flash SWF) on the same server that provides data and resource—the desktop client is independent of the server and able to load balance servers from the client side to achieve scalability for the application.
Many applications today only make AJAX or Flash remote calls—in fact, there is a lot of similarity in the ways a standard desktop application and web applications make remote calls.
For the purposes of client-side load balancing, there are three main components to a modern web application:
- Client-side code: JavaScript and/or SWF (for flash clients);
- Resources: images, CSS (Cascading Style Sheets), audio, video, and HTML documents;
- Server-side code: backend logic that generates data requested by the client.
The client-side process is therefore:
- Load the file www.mywebsite.com/servers.xml, which is stored with the client code and other resources, and contains the list of available servers, e.g.:
<servers>
<server>s1.mywebsite.com</server>
<server>s2.mywebsite.com</server>
<server>s3.mywebsite.com</server>
<server>s4.mywebsite.com</server>
</servers> - The client code randomly selects servers to call with a preset timeout for each call. If the call takes greater than the preset time, the client randomly selects another server until it finds one that responds, and uses that server for all subsequent calls.
Server Based Load Balancing
Server based load balancing can make multiple servers appear as a single server – a single virtual service – by transparently distributing user requests among the servers. Server load balancing prevents planned outages for software or hardware maintenance from disrupting service to end-users and can also provide disaster recovery services by redirecting service requests to a backup location when a catastrophic failure disables the primary site. The two categories of server based load balancing implementations are:
- Software-based load balancing: Consists of special software that is installed on the servers in a load-balanced cluster. The software dispatches or accepts requests from the client to the servers, based on different algorithms that can be a simple round-robin algorithm or a much more complicated algorithm that considers server affinity. For example, Microsoft Network Load Balancing is a load balancing software for Web farms, and Microsoft Component Load Balancing is a load balancing software for application farms.
- Hardware-based load balancing: Consists of a specialized switch or router with software to give it load balancing functionality. This solution integrates switching and load balancing into a single device, which reduces the amount of extra hardware that is required to implement load balancing. Modern hardware load balancers are appliances known as Application Delivery Controllers (ADC) and we will examine their capabilities with further detail in the following posts.
Server load balancing websites
A web server handles HTTP (Hypertext Transfer Protocol) requests sent to it by web browsers. When a user types in a URL —http://www.myweb.com, for example—the client computer sends out a request to look up the servers needed to handle requests and send responses back quickly.
Server load balancing databases
Let’s now discuss a different scenario, where we aim to achieve scalability, by comparing an existing non-load-balanced solution, which contains a single system (single point of failure) in the application tier, to a highly scalable solution that maintains performance and increases availability.
Non Load Balanced Tier
Initially an organization might start with an architecture such as the one outlined in the next figure, which might meet initial performance expectations. However, as the load increases, the application tier must adapt to the increased load to maintain acceptable performance. Since multiple redundant machines are involved in a cluster it’s good practice to have all data in a central location that can be accessed from all the cluster machines. Most likely a corporation will use a full client/server database like SQL Server in a Web farm environment, but one can also use file based data access like Visual FoxPro or Jet (Access) tables if those tables are kept in a central location accessed over a LAN connection.
In the figure, the application tier contains only one application server (DBServer), which serves client requests. If the server becomes overloaded, the system will either fall below acceptable performance levels or become unavailable.
Load Balanced Tier
To increase the scalability and to maintain performance, the organization might use a load balancer to extend the application tier. The following example, shown in the next figure, adds two servers to the application tier to create a load-balanced cluster, which accesses data from the data tier and provides application access to the clients in the client tier.
The result is a standard load-balanced design in which, either a hardware device or software that is running on the host machines, assigns a virtual host name (DBServer) and an IP address to Server1, Server2 and Server3. The load-balanced cluster exposes this virtual IP address and host name to the network and balances the load of the incoming requests evenly across healthy servers within the group. If Server1 fails, the request is simply directed to Server2 or Server3. Depending upon the technology used to provide this functionality, a certain number of additional servers can be added to the load-balanced cluster to maximize scalability and stay ahead of increasing demand.
1 comment:
What is the best content delivery network (CDN)?
what is cdn
Post a Comment