Linux Server load balancer-load average

Source: Internet
Author: User

Linux Server load balancer-load average

In the previous article, we introduced how to use the w command or the uptime command to view the average Load (avaerage) of the Linux system. What is the normal status of the average Load? How should we define the stability of the system based on the average load? Let's take a look at the basic knowledge.

Use the w command and uptime command in Linux to view the system load

The average load refers to the average utilization rate of the system's running queues. It can also be considered as the average rate of processes that can run.

Generally, a process consumes resources such as CPU, memory, disk I/O, and network I/O. In this case, the average load is not an independent CPU usage. That is, factors such as memory, disk, and network can also affect the average load of the system.

In a single-core processor, when the average load is 1 or less than 1, the system processing process is very easy, that is, the load is very low. When it reaches 3, it will appear very busy. When it reaches 5 or 8, it will not be able to handle the process very well. (5 and 8 are currently controversial thresholds. To keep them conservative, recommended ).

Example:

For example, my server has two CPUs, each of which has six cores, which is equivalent to a 12-core processor.

If the load is less than 12, the server utilization is low.

If the load is greater than 12 and less than 36, the server utilization rate is relatively high. In this case, you should consider optimizing the service or replacing the faster CPU.

If the load is greater than 36, less than 60, or even greater than 60, it indicates that the server is very dangerous and may cause problems at any time.

After the above analysis, we use the following command to obtain the average load of the system.

# Top

# Uptime

# W

Average load value, for example, load average: 0.08, 0.03, 0. 00. these values indicate the average load of the system in the last 1/5/15 minutes. so which value should we determine if the load is too high?

Based on experience: we should focus on the average load of 5/15 minutes, because the average load of 1 minute is too frequent, and a high concurrency in an instant will cause a significant change in this value.

The first row of top is the same as the result of uptime.
Uptime
Top

[Bkjia @ bkjia ~] # Uptime
20:15:58 up 7 min, 1 user, load average: 0.00, 0.10, 0.08

Where
20:15:58 up system start time
7 min online system running time
Load average records the average system load for one minute, five minutes, and fifteen minutes respectively.

It mainly determines the CPU usage. The current CPU is a multi-core, multi-thread mode. Therefore, it depends on the total number of threads. For example, our company's CPU is two units, each of which is a 4-core 8 thread. The load factor 16 is considered as 100%.

View CPU usage
Cat/proc/cpuinfo
If you only want to get the number of threads
Grep 'model name'/proc/cpuinfo | wc-l

This article permanently updates the link address:

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.