top of page

What is a Load Balancer? : A Comprehensive Guide to AWS Load Balancer


What is a Load Balancer? : A Comprehensive Guide to AWS Load Balancer

Written by Hyojung Yoon


Hello, everyone! Today, we will delve into the fascinating world of Load Balancers and Load Balancing – pivotal technologies that make the world smarter by enabling web services to maintain stability, even in high traffic situations, especially in cloud environments like AWS. These technologies enhance the service's performance, stability, and scalability.


Let’s begin our journey through the basic concepts of Load Balancers and Load Balancing to the types of AWS Load Balancers in this blog.

 
 

What is a Load Balacer?

1. Load Balancer

What is a Load Balancer?

Load Balancers sit between the client and a group of servers, distributing traffic evenly across multiple servers and thereby mitigating the load on any particular server. When there is excessive traffic to a single server, it may not handle the load, leading to downtime. To address this issue, either a Scale Up or Scale Out approach is employed.


2. Scale Up and Scale Out

Scale up & Scale Out

Scale Up improves the existing server's performance, including tasks like upgrading CPU or memory, while Scale Out distributes traffic or workload across multiple computers or servers. Each method has its advantages and disadvantages, and choosing the more appropriate one is crucial.

Scale Up

Scale Out

Scalability

Has limits in performance expansion

Continuous expasion is possible

Server Cost

Cost increases significantly with performance upgrade.

Generally, more cost-effective

Operational Cost

No significant change with scale up

Increase as the number of servers increase

Failover

Single point of failure

Lower possibility of total failure due to distributed load

In the case of Scale Out, Load Balancing is essential to evenly distribute the load among multiple servers. The primary purpose of Load Balancing is to prevent any single server from being overwhelmed by distributing incoming web traffic across multiple servers, thus enhancing server performance and stability.



What is a Load Balancing?

1. Load Balancing

Load Balancing refers to the technology that distributes tasks evenly across multiple servers or computing resources, preventing service interruption due to excessive traffic and ensuring tasks are processed without delay.


2. Benefits of Load Balancing

1) Application Availability

Server failures or maintenance can increase application downtime, rendering the application unusable for visitors. A load balancer automatically detects server issues and redirects client traffic to available servers, enhancing system fault tolerance. With load balancing, it is more manageable to:

  • Undertake application server maintenance or upgrades without application downtime

  • Facilitate automatic disaster recovery to your backup site

  • Conduct health checks and circumvent issues leading to downtime

2) Application Scalability

A load balancer can intelligently route network traffic between multiple servers. This allows your application to accommodate thousands of client requests, enabling you to:

  • Circumvent traffic bottlenecks on individual servers

  • Gauge application traffic to adaptively add or remove servers as required

  • Integrate redundancy into your system for coordinated and worry-free operation

3) Application Security

Load balancers, equipped with inbuilt security features, add an extra security layer to your Internet applications. They are invaluable for managing distributed denial-of-service attacks, where an attacker overwhelms an application server with concurrent requests, causing server failure. Additionally, a load balancer can:

  • Monitor traffic and block malicious content

  • Reduce impact by dispersing attack traffic across multiple backend servers

  • Direct traffic through network firewall groups for reinforced security

4) Application Performance

Load balancers enhance application performance by optimizing response times and minimizing network latency. They facilitate several crucial tasks to:

  • Elevate application performance by equalizing load across servers

  • Lower latency by routing client requests to proximate servers

  • Guarantee reliability and performance of both physical and virtual computing resources


Load Balancing Algorithms

Various algorithms, such as Round Robin, Weighted Distribution, and Least Connections, are employed for load balancing, each serving different purposes and scenarios.


1. Static Load Balancing

1)Round Robin Method

This method systematically allocates client requests across servers. It is apt when servers share identical specifications and the connections (sessions) with the server are transient.

  • Example: For servers A, B, and C, the rotation order is A → B → C → A.


2) Weighted Round Robin Method

This assigns weights to each server and prioritizes the server with the highest weight. When servers have varied specifications, this method increases traffic throughput by assigning higher weights to superior servers.

  • Example: Server A's weight=8; Server B's weight=2; Server C's weight=3. Hence, 8 requests are assigned to Server A, 2 to Server B, and 3 to Server C.


3) IP Hash Method

Here, the load balancer hashes the client IP address, converting IP addresses to numbers and mapping them to distinct servers. This method assures users are consistently directed to the same server.

2. Dynamic Load Balancing

1) Least Connection Method

This method directs traffic to the server with the fewest active connections, presuming each connection demands identical processing power across all servers.


2) Least Response Time Method

This considers both the current connection status and server response time, steering traffic to the server with the minimal response time. It is suitable when servers have disparate available resources, performance levels, and processing data volumes. If a server adequately meets the criteria, it is prioritized over a server that is unoccupied. This algorithm is employed by the load balancer to ensure prompt service for all users.



Types of AWS Load Balancer

Types of AWS Load Balancer - ALB, NLB

1. ALB(Application Load Balancer)

Complex modern applications often operate on server farms, each composed of multiple servers assigned to specific application functions. An Application Load Balancer (ALB) redirects traffic after examining the request content, such as HTTP headers or SSL session IDs.


For instance, an e-commerce application, possessing features like a product directory, shopping cart, and checkout functionality, when coupled with an ALB, dispenses content like images and videos without necessitating sustained user connection. When a user searches for a product, the ALB directs the search request to a server where maintaining user connection is not mandatory. Conversely, the shopping cart, which necessitates the maintenance of multiple client connections, transmits the request to a server capable of long-term data storage.

  • It facilitates application-level load balancing, apt for HTTP/HTTPS traffic.

  • It supports L7-based load balancers and can enforce SSL.


2. NLB(Network Load Balancer)

A Network Load Balancer (NLB) operates by analyzing IP addresses and various network data to efficiently direct traffic. It allows you to trace the origin of your application traffic and allocate static IP addresses to multiple servers. The NLB uses both static and dynamic load balancing methods to distribute server load effectively.


It’s an ideal solution for scenarios demanding high performance, capable of managing millions of requests per second while maintaining low latency. It’s especially adept at handling abrupt increases and fluctuations in traffic, making it particularly useful for real-time streaming services, video conferencing, and chat applications where establishing and maintaining a smart, optimized connection is crucial. In such cases, utilizing an NLB ensures effective management of connections and maintenance of session persistence.

  • It conducts network-level load balancing, suitable for TCP/UDP traffic.

  • It supports L4-based load balancers.


3. ELB(Elastic Load Balancer)

Elastic Load Balancer (ELB) automatically allocates incoming traffic amongst various targets like EC2 instance containers and IP addresses across multiple Availability Zones. With ELB, the load on both L4 and L7 can be controlled. Should the primary address of your server alter, a new load balancer must be created and a target group must be assigned to a singular address, making the process more complex and cost-intensive with the increase in targets.

  • It accommodates the four types of load balancers provided by AWS.

  • It extends substantial scalability and adaptability to cater to diverse needs and environments.


Conclusion

We have delved into the intricate domains of load balancers and load balancing, recognizing the indispensable role a load balancer plays in moderating website and application traffic and allocating server load to bolster service performance and stability.


Particularly within cloud environments like AWS, a plethora of load balancing options and functionalities are available, allowing the implementation of the most suited solution for your services and applications.


Such technological advancements empower us to offer quicker and more reliable services, culminating in enhanced user experience and customer contentment, thus forging the path to business success.



Links

235 views0 comments

Comments


bottom of page