四层负载均衡 负载均衡算法
负载均衡 (Load balancing)
Let us first know what load balancing is?
首先让我们知道负载平衡是什么?
So, Load balancing is a methodology in computer to distribute the workloads among multiple processors, for maintaining high availability, high reliability, high scalability and case of maintenance in resource sharing.
因此, 负载平衡是计算机中在多个处理器之间分配工作负载的一种方法,用于维护高可用性,高可靠性,高可伸缩性和资源共享维护的情况 。
Techniques of load balancing:
负载均衡技术:
Push Migration:
推送迁移 :
Overloaded processors in one CPU is pushed to another processor for processing.
一个CPU中的过载处理器将被推送到另一处理器进行处理。
Pull Migration:
拉移 :
The processor which is overloaded is pulled from a processor and it is put under another processor for processing.
从处理器中拉出过载的处理器,并将其置于另一个处理器下进行处理。
负载均衡的类型 (Types of Load balancing)
Mainly there are two types of load balancing i.e. Static load balancing and Dynamic load balancing.
负载均衡主要有两种,即静态负载均衡和动态负载均衡 。
i)静态负载平衡 (i) Static load balancing)
The static load balancing method is non-primitive one the load is allocated to the node it cannot be transferred to another node under processing.
静态负载平衡方法是非原始方法,它会将负载分配给该节点,无法将其转移到正在处理的另一个节点。
The main drawback it does not take the current state of the system while making allocation decisions.
主要缺点是在进行分配决策时不会占用系统的当前状态。
There are different algorithms of static load balancing such as:
静态负载均衡有多种算法,例如:
Round Robin algorithm
循环算法
Central Manager algorithm
中央管理器算法
Threshold algorithm
阈值算法
Randomized algorithm
随机算法
ii)动态负载平衡 (ii) Dynamic load balancing)
In dynamic load balancing the changes on the system's workload are monitored and redistributed accordingly.
在动态负载平衡中 ,将监视并重新分配系统工作负载上的更改。
There are several algorithms of Dynamic load balancing also, but in this article, we will only discuss the different algorithms of static load balancing.
也有几种动态负载平衡算法,但是在本文中,我们将仅讨论静态负载平衡的不同算法。
Round Robin Algorithm
循环算法
In this algorithm, the load is distributed evenly to all nodes or processors. The workload is distributed in a round-robin order. Where the equal load is assigned to each node in circular order without any priority and will be back to the first node if the last node has been reached.
在此算法中,负载平均分配给所有节点或处理器。 工作负载按循环顺序分配。 如果相等的负载以循环顺序分配给每个节点而没有任何优先级,并且如果到达最后一个节点,则将负载返回到第一个节点。
Advantages and disadvantages:
的优点和缺点:
Round robin is easy to implement, simple and starvation.
轮循很容易实现,简单而又饥饿。
It does not require inter-process communication and still gives the best performance but it cannot give expected result when the jobs are unequal processing time.
它不需要进程间的通信,并且仍然可以提供最佳性能,但是当作业的处理时间不相等时,它不能给出预期的结果。
Central Manager Algorithm
中央管理器算法
In this algorithm, a central node selects the slave node for transferring the load.
在该算法中,中央节点选择从节点以传输负载。
Slave node having the least load is selected and assigned the jobs.
选择负载最小的从节点并分配作业。
Advantages and disadvantages:
的优点和缺点:
The algorithm needs a high level of interprocess communication which can sometimes lead to the bottleneck state.
该算法需要高水平的进程间通信,有时可能会导致瓶颈状态。
This algorithm performs better than dynamic activities are created by every host.
该算法的性能要优于每个主机创建的动态活动。
Threshold Algorithm
阈值算法
According to this, the load is assigned immediately upon the creation of the node. The load is characterized in 3 labels: Under load, medium loaded and overloaded.
据此,在创建节点后立即分配负载。 负载具有3个标签: 负载 , 中等负载和过载 。
Two terms or we can say parameters are used to describe these three levels:
我们可以说用两个术语或参数来描述这三个级别:
Underloaded → load < Tunder
欠载→负载<Tunder
Medium → Tunder <= Load <= Tupper
中→助攻<=加载<=助攻
Overloaded → Load >Tupper
重载→荷载>小号
Advantages and disadvantages:
的优点和缺点:
This algorithm has low intercrosses communication and reduces the overhead of remote process allocation which leads to improvement in performance.
该算法具有较低的交叉通信,并减少了远程进程分配的开销,从而提高了性能。
The complexity of comparing each node to with some specified threshold is high.
将每个节点与某个特定阈值进行比较的复杂度很高。
Randomized Algorithm
随机算法
The load is selected on random selection without having information about the current or previous load on the node.
根据随机选择选择负载,而没有有关节点上当前或先前负载的信息。
Advantage and disadvantage:
优缺点:
Each node maintains its load record. Hence no interprocess communication is required.
每个节点都维护其负载记录。 因此,不需要进程间通信。
Conclusion:
结论:
In the above article, we have discussed the different types of load balancing and have also discussed several algorithms of static load balancing. I hope you have understood the article well, for any further queries hit your queries in the comment section.
在上面的文章中,我们讨论了不同类型的负载平衡 ,还讨论了几种静态负载平衡算法 。 希望您对这篇文章了解得很好,对于任何其他查询,请在评论部分中查询。
翻译自: https://www.includehelp.com/basics/load-balancing-and-its-types.aspx
四层负载均衡 负载均衡算法