Talk about load balancing algorithms

Source: Internet
Author: User

Load balancing algorithms can be divided into two categories: Static load Balancing algorithm, server-based capacity, is a high-configuration server than the low-provisioned server to allocate more requests, dynamic load balancing algorithm according to the state of the server, such as through monitoring can get average response time, or CPU occupancy rate, Memory usage is calculated in some way, as a weight value

Static load Balancing algorithm

Random: Select a server using the random number generation algorithm and send the connection to him. While many load products support this algorithm, its effectiveness has been challenged until the server's uptime is seen to be heavy.

Polling (Round Robin): Each new connection request is assigned to the next server sequentially, and all requests are eventually split to all servers. Polling algorithms work well in most cases, but if load-balanced devices are not fully equal in terms of processing speed, connection speed, and memory, the effect can be compromised

Weighted polling (Weighted Round Robin): The number of connections per server in the algorithm is assigned by weight ratio. It is an improvement to the ordinary polling algorithm

Priority: Groups all servers, each group defining priorities, prioritizing requests to the highest priority server group (within the same group, polling or weighted polling for allocation of requests), and sending requests to the secondary priority server group when all servers in the highest priority group fail.

Dynamic Equalization Algorithm

Dynamic polling (dynamically Round Robin): Similar to weighted polling, but the weight values are based on the continuous monitoring of each flick and are constantly updated. The request is assigned based on the real-time performance analysis of the server.

Minimum connection (Least Connection): The system assigns the new request to the server with the fewest number of current connections. This algorithm is very effective in the environment where the computing ability of each server is basically similar.

Fastest algorithm (fastest): The fastest algorithm is based on the fastest response time in all servers to the allocation connection. This algorithm is particularly useful in environments where servers span different networks.

Observation algorithm (observed): The algorithm uses the minimum connection algorithm and the fastest connection algorithm to implement load balancing. The server gets a score based on the current number of connections and the corresponding time, and the higher the score, the better the performance and the more connections are allocated.

Pre-judgment Algorithm (predictive): The algorithm uses an observation algorithm to calculate scores, but it will analyze the trend of the score to determine the performance of a server, is improving or decreasing, the server with improved trend will get more connections. The algorithm is suitable for most environments.

After saying the above concept, it is necessary to practice, here to implement a weighted polling load balancing algorithm

Finally, the code download

Talk about load balancing algorithms

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.