Load balancing principle and implementation algorithm of Linux cluster

Source: Internet
Author: User
Tags linux

Under the condition that the price of computer hardware declines and the network topology develops, distributed computer system provides a rich collection of resources for users. When people study distributed systems, they notice a problem: In a multiple-computer environment connected by a network, at a certain point, some computers load more heavily, while others are lighter. Balancing the load between computers is a major goal of task assignment and scheduling, which can improve the performance of the whole system.

In order to improve the performance of the system, the load balance of each computer is basically balanced by allocating the load reasonably between multiple computers, which is often referred to as load balancing or load sharing. In general, load balancing aims to achieve a basic balance of load between computers, while load sharing means simply a redistribution of the load.

Load balancing includes two kinds, one is static load balancing, the other is dynamic load balancing. The method of using the average information of the system load and ignoring the current load state of the system is called static load balancing. The method of adjusting task partitioning according to the current load state of the system is called dynamic load balancing.

The resulting load imbalance is mainly due to:

The iteration size of some algorithms is not fixed, but the size of the iterations can be evaluated at compile time;

The iteration size of some algorithms is not fixed, and the size of the iterations depends on the data being processed and cannot be evaluated at compile time.

Even if the iteration size is fixed, there are many uncertainties that can result in a difference in computational speed.

To investigate these three reasons, the first case can estimate the workload of each iteration at compile time, and distribute the iteration according to the processing ability of the processing node, which is the method of static load balancing. In the second to third case, dynamic load balancing must be used to dynamically migrate tasks and achieve dynamic load balancing according to the tasks of each processing node in the course of operation. Dynamic load balancing needs to investigate the processing ability of the processing node, and its basic basis is to predict the future processing speed according to the previous processing speed of the processing node.

Load Balancing algorithm

A load-balancing algorithm consists of the following three components:

Information policy: The amount of load and task that the creator of the task placement strategy uses, and how the information is distributed.

Routing strategy: based on task and computer load, determine whether to transfer a task to another computer for processing.

Placement policy: For tasks that are suitable for transfer to other computers, select the destination computer where the task will be transferred.

The above three parts of load balancing interact in different ways. The placement policy utilizes the load information provided by the Information policy to act only after the task is judged by the routing strategy to be appropriate for transmission.

In short, the goal of load balancing is to provide the shortest average task response time, the load that can be adapted to change, and the reliable load-balancing mechanism.

Information policy

The parameters that people use to describe load information are:

The number of tasks in the running queue;

The rate of system calls;

CPU context switching rate;

Percent of idle CPU time;

The size of the idle memory (k bytes);

Average load within 1 minutes. For these individual load description parameters, the first (1), which uses the number of tasks in the running queue as the parameter to describe the load, is proved to be the most effective, that is, its average task response time is shortest and has been widely used. However, if more parameters are collected in order to make system information more comprehensive, it is often due to additional overhead but not the desired performance improvement. For example, by combining "and" or "or" with one of the six parameters, the average response time is less than the average response time of a single parameter.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.