Linux system CPU Usage (load average) grooming

Source: Internet
Author: User
Tags cpu usage

In peacetime operations, when a server has a performance problem, it usually looks at the current CPU usage, especially the load of the CPU (load average).
To get the CPU load of the server, there are three kinds of commands:

1) w command [[email protected] ~]# W 12:12:41 up 167 days, 20:46,  2 users,  load average:0.00, 0.01, 0.05USER     tty
   
    from             [email protected]   IDLE   jcpu   PCPU whatroot     pts/0    192.168.1.5      10:01    1.00s  0.11s  0.00s wroot     pts/2    192.168.1.5      10:19    1:47m  0.04s  0.04s- BASH2) Uptime command [[email protected] ~]# uptime 12:12:55 up 167 days, 20:46,  2 users,  load average:0.00, 0.01, 0.05 3) Top command [[email protected] ~]# toptop-12:13:22 up 167 days, 20:47,  2 users,  load average:0.00, 0.01, 0.05Tasks : 272 Total,   1 running, 271 sleeping,   0 stopped,   0 zombie%cpu (s):  0.0 us,  0.1 sy,  0.0 ni, 9 9.9 ID,  0.0 wa,  0.0 hi,  0.0 si,  0.0 stkib mem:65759080 Total, 58842616 free,   547908 used,  6368556 Buff/cachekib Swap:  2097148 Total,  2097148 free,        0 used. 64264884 avail Mem .......
   

Simply say the difference between CPU load and CPU utilization

1) CPU utilization: Shows the percentage of CPU that the program consumes in real time during runtime 2) CPU load: Shows the average number of tasks that are being used and waiting for the CPU over time. High CPU utilization does not mean that the load is necessarily large. For example: If I have a program that needs to use the CPU's computing function all the time, then CPU usage may reach 100%, but the CPU workload is approaching "1" because the CPU is only responsible for one job! What if two of these programs are executed at the same time? The CPU usage is still 100%, but the workload becomes 2. So that is to say, when the CPU workload is larger, the CPU must be switching between different jobs frequently. ------------------------Below a telephone booth phone analogy to illustrate the difference between the two------------------------a public telephone kiosk, there is a person on the phone, four people waiting, each limit the use of the phone for one minute, If someone does not finish the call within a minute, they can only hang up the phone and wait for the next round. The phone is the equivalent of the CPU, and the person who is or is waiting for the call is the equivalent of the task. In the use of telephone booths, it is certain that someone will be out of the phone, some people do not call and choose to re-queue, there will be new people in the line here, the number of changes is equivalent to the number of tasks increase or decrease. To count the average load, we counted the number of people in 5 minutes and averaged the statistics at 1th, 5, and 15 minutes, resulting in an average load of 1th, 5 and 15 minutes. Some people pick up the phone to play, has been playing 1 minutes, and some people may be in the first 30 seconds to find the phone number, or hesitate to play, after 30 seconds is really on the phone. If you think of the phone as a CPU, the number of people as a task, we say the previous person (Task) CPU utilization is high, the latter one (Task) CPU utilization is low. Of course, the CPU does not work in the first 30 seconds, after 30 seconds to rest, just said, some programs involve a lot of computation, so CPU utilization is high, and some programs involved in the calculation of the few, CPU utilization is naturally low. However, regardless of the CPU utilization is high is low, with the number of tasks behind the queue does not necessarily have a relationship.

  

Linux system CPU Usage (load average) grooming

Related Article

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.