Search CTRL + K

Load Balancing

负载均衡(load balancing,LB) 是用于给多个服务充当流量代理的解决方案,它负责分发不同应用流量到不同服务,还负责平衡不同服务器上同一个服务的流量负载以提高整体应用程序性能、稳定性,同时需要保持会话。负载均衡负载均衡器(load balancer,LB) 实现,有专用硬件实现,也有软件实现。

即使后端实例只有一个,也建议部署负载均衡器做一对一转发,因为 负载均衡 有许多重要优势:










通常根据 OSI 模型 分类 负载均衡器,有四层负载均衡器和七层负载均衡器。

What is load balancing?

Load balancing is the practice of distributing computational workloads between two or more computers. On the Internet, load balancing is often employed to divide network traffic among several servers. This reduces the strain on each server and makes the servers more efficient, speeding up performance and reducing latency. Load balancing is essential for most Internet applications to function properly.[1]

What is load balancer?

A load balancer is a solution that acts as a traffic proxy and distributes network or application traffic across endpoints on a number of servers. Load balancers are used to distribute capacity during peak traffic times, and to increase reliability of applications. They improve the overall performance of applications by decreasing the burden on individual services or clouds, and distribute the demand across different compute surfaces to help maintain application and network sessions.[2]

What is a load balancing algorithm?

A load balancing algorithm is the logic that a load balancer uses to distribute network traffic between servers (an algorithm is a set of predefined rules).

There are two primary approaches to load balancing. Dynamic load balancing uses algorithms that take into account the current state of each server and distribute traffic accordingly. Static load balancing distributes traffic without making these adjustments.[3]

Load Balancing ALgorithms

There are two types of load-balancing algorithms in terms of how they operate: static and dynamic. Static load balancing measures the incoming load on a server using algorithms that have performance capacity information about the existing servers in the distributed network. Dynamic load balancing can dynamically identify the amount of load that needs to be shed during runtime and which system should bear the load.[2:1]

Static load balancing algorithms

Static load balancing algorithms distribute workloads without taking into account the current state of the system. A static load balancer will not be aware of which servers are performing slowly and which servers are not being used enough. Instead it assigns workloads based on a predetermined plan. Static load balancing is quick to set up, but can result in inefficiencies.[1:1]

Dynamic load balancing algorithms

Dynamic load balancing algorithms take the current availability, workload, and health of each server into account. They can shift traffic from overburdened or poorly performing servers to underutilized servers, keeping the distribution even and efficient. However, dynamic load balancing is more difficult to configure. A number of different factors play into server availability: the health and overall capacity of each server, the size of the tasks being distributed, and so on.[1:2]

  1. ↩︎ ↩︎ ↩︎

  2. ↩︎ ↩︎

  3. ↩︎