What is Load Balancing?
Load balancing enhances the distribution of workloads across multiple computing devices, for example, network links, computers, a computer cluster, disk drives or central processing units (CPU). Load balancing tries to optimize resource utilisation, improve throughput, reduce response time, and decrease overload of any single resource. Using many elements with load balancing rather than a single component may further make security and availability through redundancy. Similar to a multilayer switch or a Domain Name System server process load balancing normally involves dedicated software or hardware.
Load balancing varies from channel bonding in that load balancing splits traffic between network interfaces on a network socket base, while channel bonding indicates a division of traffic between physical interfaces at a below level, either per packet or on a data link basis with a protocol like most precise path bridging.
Load balancing indicates the distribution of incoming network traffic in an organised manner over an assortment of back-end servers, which is identified as a server pool or server farm.
All the new high-traffic websites must complete numerous simultaneous requests from users or clients and deliver the correct images, text, application data, video, etc. in a quick and assured way. To scale cost-efficiently to reach these high volumes, modern computing best practice usually demands attaching more servers.
A load balancer functions like traffic controller in your servers. Routing client requests over all servers capable of settling those requests in a way that improves speed and capacity utilization and make sure that not even one server is overburdened. Which could result in deteriorate performance. If a single server goes depressed, the load balancer redirects traffic to the rest of the online servers. When a new server is joined to the server combination, the load balancer automatically begins to send requests to it.
Load balancer makes the following functions in the above-mentioned practice:
- Distributes network load or client requests systematically across many servers
- Assures high availability and security by sending requests solely to servers that are online
- Gives the adaptability to combine or deduct servers when needed
Load Balancing Algorithms
Various load balancing algorithms give diverse advantages, the selection of the load balancing method depends on each requirement:
- IP Hash: The IP address of the client is employed to decide which server gets the request.
- Round Robin: Requests are issued across the group of servers in order.
- Least Connections: A new request is sent to the server with the less current connections to clients. The relative computing capacity of each server is factored into concluding which one has the fewest connections.
Data about a user’s session is oftentimes saved sectionally in the browser. For instance, in an online retail app, the items in a customer’s shopping cart may be collected at the browser level up to when the user buys them. The server receiving requests from that customer in the midst of the buying can cause execution issues or complete transaction breakdown if changed. In cases like these, it is necessary that all requests from a client are assigned to the same server for the term of the session. This is identified as ‘session persistence’.
The best load balancers can manage session persistence as required. An added use case for session persistence is when an upstream server stores data demanded by a user in its cache to increase performance. Switching servers would create that data to be obtained for the second time, producing performance incompetence.
Server Groups and Dynamic Configuration
Dynamic applications need new servers to be combined or taken down on a regular base. This is prevalent in settings such as the Amazon Web Services (AWS) or Elastic Compute Cloud (EC2), which allows users to spend only for the computing volume they really use, while at the same time, guaranteeing that capacity scales up in response to traffic increases. In such environments, it considerably benefits if the load balancer can dynamically join or separate servers from the collection without disrupting real connections.
What are the different types of load Balancers?
Elastic Load Balancing maintains the following types of load balancers – Network Load Balancers, Application Load Balancers, and Classic Load Balancers. In brief, Application Load Balancers are utilised to route HTTP/HTTPS (or Layer 7) traffic. Network Load Balancers and Classic Load Balancers are applied to route TCP (or Layer 4) traffic. Now, let’s look at them more in detail.
- Network Load Balancer: A Network Load Balancer performs routing arrangements at the transport layer (TCP/SSL). It can control millions of requests per second. After the load balancer accepts a connection, it picks a target from the target group for the default rule employing a flow hash routing algorithm. It tries to open a TCP connection to the chosen target on the port designated in the listener configuration. It sends the request without changing the headers. Dynamic host port mapping is supported by Network Load Balancers. For instance, if your task’s container definition particularises the port 80 for a container port, and port 0 for the host port, then the host port is dynamically selected from the temporary port range of the container instance.
- Application Load Balancer: This type of a Load Balancer executes routing decisions at the application layer (HTTP/HTTPS), helps path-based routing, and can route requests to one or more ports on every container instance in the cluster. Dynamic host port mapping is supported by Application Load Balancers. For instance, if the assignment ‘s container definition defines port 80 for an NGINX container port, and port 0 for the host port, then the host port is dynamically determined from the temporary port range of the container instance. When the assignment is started, the container is recorded with the Application Load Balancer as an instance ID and port combination, and traffic is allocated to the instance ID and port associated with that container. This dynamic mapping enables you to have multiple tasks from a particular service on the same container instance.
- Classic Load Balancer: A Classic Load Balancer does routing decisions at either the transport layer (TCP/SSL) or the application layer (HTTP/HTTPS). Classic Load Balancers now need a solidified relationship between the load balancer port and the container instance port. For illustration, it is likely to map the load balancer port 80 to the container instance port 3030 and the load balancer port 4040 to the container instance port 4040. But, it is not practicable to map the load balancer port 80 to port 3030 on one container instance and port 4040 on a different container instance. This static mapping needs that your cluster has at least as many container instances as the coveted count of a single service that utilises a Classic Load Balancer.
Hardware vs. Software Load Balancing
Load balancers normally appear in two types, one is Software based and another is Hardware based. The Hardware based business solutions pack exclusive software onto the machine they produce, which normally uses particular processors. To cope with increasing traffic on your site, you have to purchase more or larger devices. Software solutions usually run on commodity hardware, making them less costly and more manageable. You can install the software on the hardware of your preference or in cloud settings like AWS EC2.
Usage in Datacenter Networks
Load balancing is extensively used in data center networks to allocate traffic over many existing paths within any two servers. It provides more effective use of network bandwidth and decreases provisioning charges. In common, load balancing in data centre networks can be categorised as either static or dynamic. Static load balancing divides traffic by computing a hash of the source and target addresses and port numbers of traffic progress and using it to plan how flows are assigned to one of the currently existing paths. Dynamic load balancing selects traffic flows to paths by observing bandwidth utilization of various paths. The dynamic responsibility can also be proactive or reactive.
ApacheBooster helps in load balancing for low performing servers. This is because it contains the combination of Nginx and Varnish that can gradually improve server response time by diverting the network traffic. By installing ApacheBooster plugin one can see for themselves how smooth their server can perform.