Load Balancing

Load Balancing

What do we have today?

load balancing in real time
Load balancing in real life scenerio

  • Load balancing definition
  • Load balancing algorithms
  • How does load balancing works?
  • Types of load balancing
  • Advantages and disadvantages.

Load Balancing Definition

Load balancing?distributes high network traffic?across multiple?servers, allowing organizations to scale horizontally to meet high-traffic workloads. Load balancing routes client requests to available servers to spread the workload evenly and improve application responsiveness, thus increasing website availability.

Load balancing applies to?layers 4-7?in the seven-layer Open System Interconnection (OSI) model. Its capabilities are:

  • L4.?Directing traffic based on network data and transport layer protocols, e.g.,?IP address?and TCP port.
  • L7. Adds content switching to load balancing, allowing routing decisions depending on characteristics such as HTTP header, uniform resource identifier, SSL session ID, and HTML form data.
  • GSLB.?Global Server Load Balancing expands L4 and L7 capabilities to servers in different sites.

Load Balancing Algorithms

Different load balancing algorithms provide different benefits; the choice of load balancing method depends on your needs:

  • Round Robin?–?Requests are distributed across the group of servers sequentially.

No alt text provided for this image
Round Robin


  • Least Connections?–?A new request is sent to the server with the fewest current connections to clients. The relative computing capacity of each server is factored into determining which one has the least connections.

No alt text provided for this image
Least Connection


  • Least Time?– Sends requests to the server selected by a formula that combines the
  • fastest response time and fewest active connections. Exclusive to NGINX Plus.

No alt text provided for this image
Least Time


  • Hash?– Distributes requests based on a key you define, such as the client IP address or
  • the request URL. NGINX Plus can optionally apply a consistent hash to minimize redistribution
  • of loads if the set of upstream servers changes.

No alt text provided for this image
Hash load balancing


  • IP Hash?–?The IP address of the client is used to determine which server receives the request.
  • Random with Two Choices?– Picks two servers at random and sends the request to the
  • one that is selected by then applying the Least Connections algorithm (or for NGINX Plus
  • the Least Time algorithm, if so configured).

No alt text provided for this image
Custom Load algorithm


How Does Load Balancing Work?

Load balancers sit between the application servers and the users on the internet. Once the load balancer receives a request, it determines which server in a pool is available and then routes the request to that server.

No alt text provided for this image
How load balancing works

By?routing the requests to available servers?or servers with lower workloads, load balancing takes the pressure off stressed servers and ensures high availability and reliability.

Load balancers?dynamically add or drop servers?in case of high or low demand. That way, it provides flexibility in adjusting to demand.

Load balancing also?provides failover?in addition to boosting performance. The load balancer redirects the workload from a failed server to a backup one, mitigating the impact on end-users.

Bullet points

  • Users access web servers or applications.
  • The load balancer receives and distributes requests to multiple servers using IP addresses.
  • If a server is down, it can divert traffic to another available server.

Types of Load Balancing

Load balancers vary in storage type, balancer complexity, and functionality. The different types of load balancers are explained below.

Hardware-Based

A hardware-based load balancer is?dedicated hardware with proprietary software?installed. It can process large amounts of traffic from various application types.

Hardware-based load balancers contain in-built virtualization capabilities that allow multiple virtual load balancer instances on the same device.

Pros

  • They provide fast?throughput, as the software is run on specialized processors.
  • These load balancers offer better security, as they're handled only by the organization and not by any third party.
  • They come with a fixed cost at the time of purchase.

Cons

  • Hardware load balancers require extra staff and expertise to configure and program them.
  • They can't scale when a set limit on several connections has been reached. When this happens, connections are either refused, dropped or degraded, and the only option is to purchase and install additional machines.
  • They're more expensive, as the cost of their purchase and maintenance is higher. Owning a hardware load balancer might require hiring consultants to manage it.


Software-Based

A software-based load balancer runs on virtual machines or white box servers, usually incorporated into?ADC?(application delivery controllers). Virtual load balancing offers superior flexibility compared to the physical one.

Software-based load balancers run on common?hypervisors, containers, or as Linux processes with negligible overhead on a?bare metal server.

Pros

  • They offer the flexibility to adjust to the changing needs and requirements of a network.
  • By adding more software instances, they can scale beyond the initial capacity.
  • They offer cloud-based load balancing, which provides off-site options that can operate on an elastic network of servers. Cloud computing also offers options with various combinations, such as?hybrid?with in-house locations. For example, a company could have the main load balancer on premises, and the backup load balancer could be in the cloud.

Cons

  • When scaling beyond capacity, software load balancers might cause an initial delay. This usually happens when the load-balancer software is being configured.
  • Since they don't come with a fixed upfront cost, software load balancers can add ongoing costs for upgrades.


Virtual

A virtual load balancer deploys the proprietary load balancing software from a dedicated device on a virtual machine to combine the two above-mentioned types. However, virtual load balancers cannot overcome the architectural challenges of limited scalability and automation.

Cloud-Based

Cloud-based load balancing utilizes cloud infrastructure. Some examples of cloud-based load balancing are:

  • Network Load Balancing. Network load balancing relies on layer 4 and takes advantage of network layer information to determine where to send network traffic. Network load balancing is the fastest load balancing solution, but it lacks in balancing the distribution of traffic across servers.
  • HTTP(S) Load Balancing. HTTP(S) load balancing relies on layer 7. It is one of the most flexible load balancing types, allowing administrators to make traffic distribution decisions based on any information that comes with an HTTP address.
  • Internal Load Balancing. Internal load balancing is almost identical to network load balancing, except it can balance distribution in internal infrastructure.

Advantages of Load Balancing

Those are some load balancing methods, so what are the advantages of using load balancing, let’s look at the following.

Increase Flexibility

The website admin will be more flexible in handling website traffic because the server load is balanced. They will be able to carry out server maintenance tasks in stages without the need to turn off the website or wait for the website to enter idle time.

Load balancing can allow admins to save loads to one server while other servers perform maintenance.

Reduce Downtime and Increase Performance

Load balancing can make it easier for admins to perform server maintenance anywhere and anytime. So you don’t need to worry about reducing or increasing website performance at the same time.

Efficient Failure Management

Load balancing can assist accessors in detecting failures as well as handling them efficiently. That way the failure that occurs does not affect the existing server load. By using multiple distributed data centers, you can bypass the path of detected failures and redirect resources to other servers that are not affected.

Simplify the Traffic Distribution Process

Can simplify the traffic distribution process, if you are maintaining a website on multiple servers using load balancing then operational failures can be significantly limited. So that load balancing can eliminate unnecessary processes such as redundancies.

If there is a failure in sending traffic to two or more servers and one server fails. Then load balancing will automatically redirect traffic to another server. With a balanced server load, you can feel safe because the server will always be online to handle website traffic.

Ease of Upgrade and Downgrade

The higher the number of visitors to your website, the higher the traffic, which has the potential to make your website slow and even fail to load content.

To avoid this, you can use load balancing which can spread servers to one or more servers that are easy to handle. Server administrators will find it easier to scale up and down the server as needed.

Disadvantages of Load Balancing

In addition to the advantages of load balancing, there are also disadvantages that you may need to consider before using load balancing on your web server. The following two disadvantages of load balancing:

Requires Additional Configuration

The use of load balancing requires additional configuration in maintaining a continuous connection between the client and server. And also you can reconfigure the load balancer if there is an array change in the downstream cluster. For example, there is a deletion or addition of nodes.

Expensive cost

This applies to those of you who use hardware load balancing. Yes, as previously said, this hardware load balancing has a price that is not cheap compared to the software version.


No alt text provided for this image
balancing load in real time.

Subscribe to my Saturdays with Codes if you haven't and also share with your friends lets build a community together.

Ronaald Patrik (He/Him/His)

Leadership And Development Manager /Visiting Faculty

1 年

????

回复
John Daniels Adeyemi

Senior Software Engineer @SellMedia | MERN Stack & Flutter | AI/ML Enthusiast | Flutter Lover ?? | I love to talk about tech #Flutter #React #Nextjs #Nodejs #Vuejs #Django #Python #Dart #Typescript #Java

1 年

I love the way you dived deep into load balancing from different perspectives like the hardware and software. Thanks for Sharing ??

Patrick Dongmo BeKind

Digital Enthusiast /"Kindness is an art that only a strong person can be the artist."| 36K+ | Kindness Ambassador | 2M+ content views | Influencer Marketing |

1 年

Good one?

回复
Jandeep Singh Sethi

| HR Leader & Founder | I help you build your brand and skyrocket audience| 368K+ | Helped 400+ brands on LinkedIn | Organic LinkedIn Growth | Author |900M+ content views | Lead Generation | Influencer Marketing

1 年

Wonderful one

回复
Shah Zaib

Customize your application to align with the requirements of the opportunity. Highlight relevant skills, experiences, and achievements that directly relate to the position or project,

1 年

Great share

回复

要查看或添加评论,请登录

社区洞察

其他会员也浏览了