link: Cloud Architecture, Distributed Systems

Load Balancing

Diagram

Overview

Load balancing is a technique used to distribute network or application traffic across multiple servers to ensure no single server becomes overwhelmed. It improves the availability and reliability of applications by distributing workloads more evenly, enhancing performance and preventing server overload.

Key Concepts

Summary

  • Distribution: Evenly distributes incoming traffic among multiple servers.
  • High Availability: Ensures continuous operation by redirecting traffic to healthy servers if one fails.
  • Scalability: Facilitates horizontal scaling by adding more servers to handle increased load.
  • Health Monitoring: Continuously checks the health of servers to route traffic only to those that are operational.

Types of Load Balancers

Summary

  • Hardware Load Balancers: Physical devices that distribute traffic.
  • Software Load Balancers: Software applications that manage traffic distribution.
  • Cloud Load Balancers: Load balancing services provided by cloud providers, such as AWS Elastic Load Balancing (ELB) and Azure Load Balancer.

Load Balancing Algorithms

Diagram

Link to original

Summary of Load Balancing Algorithms

Summary

  • Round Robin: Distributes requests sequentially among servers.
  • Least Connections: Sends requests to the server with the fewest active connections.
  • Weighted Round Robin: Similar to Round Robin, but assigns a weight to each server based on its capacity. Servers with higher weights receive more requests.
  • Weighted Least Connections: Directs traffic to servers with fewer active connections, considering the weight of each server.
  • IP Hash: Distributes requests based on the client IP address, ensuring that the same client is always directed to the same server.
  • Least Response Time: Sends requests to the server with the fastest response time.
  • Random: Distributes requests to servers randomly, providing a simple way to balance load.
  • Least Bandwidth: Directs traffic to the server currently handling the least amount of network traffic.
  • Custom Load: Uses custom metrics or algorithms to distribute traffic based on specific needs or conditions.
Link to original

Load balancing is integral to various architectural patterns and systems:

Summary

  • Microservices Architecture Pattern: Ensures efficient distribution of requests across multiple microservices instances.
  • Distributed Systems: Enhances the performance and reliability of distributed systems by balancing the load across multiple nodes.
  • Event-driven Architecture Pattern: Balances the load of event processing systems, ensuring timely handling of events.
  • Fault Tolerance: Supports fault tolerance by rerouting traffic away from failed servers to maintain service availability.
  • Scalability: Facilitates Horizontal Scaling, allowing systems to handle increased traffic by adding more servers.