View the average load of the CentOS Operating system

Source: Internet
Author: User
1. the concept of average load in Linux sometimes finds that the system response is slow, but we cannot find the cause. in this case, we need to check the average load, check whether a large number of processes are waiting in the queue. The average number of processes in the running queue within a specific interval can reflect the system's degree of busyness. Therefore, we usually check the system load as soon as our website or system slows down, that is, the average CPU load. 2. how can I view the average load? The simplest command is uptime, as shown below: [root @ loc

1. concept of average load in Linux

Sometimes we feel that the system response is slow, but we cannot find the cause. now we need to check the average load to see if there are a large number of processes waiting in the queue. The average number of processes in the running queue within a specific interval can reflect the system's degree of busyness. Therefore, we usually check the system load as soon as our website or system slows down, that is, the average CPU load.

2. View average load

How should I view the average load? The simplest command is uptime, as shown below:

[Root @ localhost ~] # Uptime 11:31:11 up 11 days, 2 users, load average: 0.02, 0.01, 0.00 the current mainstream servers are dual-core, with a very powerful CPU, for general application services, we don't have to worry about the Linux system load.

You can also run the w command to check which users and terminals are occupied by the system, as shown below:

[Root @ localhost ~] # W 11:33:00 up 11 days, 2 users, load average: 0.00, 0.00, 0.00 user tty from login @ idle jcpu pcpu what root pts/1113.57.224.3 09: 032: 11 m 0.04 s 0.04 s-bash root pts/2113.57.224.3 11: 310. 00 s 0.02 s 0.00 s w in addition, there is a dynamic command top, this command can also reflect the system load. In the command prompt below, we only care about the bold font.

[Root @ localhost ~] # Top-11:37:47 up 11 days, 2 users, load average: 0.00, 0.00, 0.00 Tasks: 122 total, 1 running, 121 sleeping, 0 stopped, 0 zombie Cpu (s): 0.1% us, 0.0% sy, 0.0% ni, 99.9% id, 0.0% wa, 0.0% hi, 0.0% si, 0.0% st Mem: 4044136 k total, 1435504 k used, 2608632 k free, 274740 k buffers Swap: 8193140 k total, 0 k used, 8193140 k free, 941884 k cached. what does the content displayed in bold font mean? Check again through uptime.

[Root @ localhost ~] # Uptime 11:39:36 up 11 days, 19: 16, 1 user, load average: 0.09, 0.03, 0.01 indicates the average number of processes in the process queue in the past 1 minute, 5 minutes, and 15 minutes.

So how can we determine whether the current system is overloaded? You can consider the following points.

If the number of active processes per CPU (based on the number of CPU cores) is not greater than 3, the system performance is good.

It is acceptable if the number of active processes per CPU is not greater than 4.

If the number of active processes on each CPU is greater than 5, the system performance problem is serious.

You can also use the vmstat command to determine if our system is too busy. if it is determined that it is very busy, consider whether to change the server or increase the number of CPUs. Summary:

If r is often greater than 3 or 4 and the id is often less than 50, it indicates that the CPU load is heavy.

In the above example, my server is PowerEdge 2850, and the CPU is dual-core and dual-threaded, then 0.09/2 = 0.045 (load value/actual number of CPUs ), the CPU load of this system can be ignored. In fact, the CPU of mainstream servers is very powerful. if it is not a special scenario such as application virtualization, the load is basically very small.

According to the previous formula, the CPU load threshold of the Nagios alarm is set to the number of CPU cores (that is, the number of CPU physical cores X the number of cores ). Take my server PowerEdge 2850 as an example. if the number of CPU cores is 2 × 2 = 4, set the alarm value to 4. this setting is reasonable because not every application server's CPU supports multiple cores. after all, some servers with poor performance are used for backup on the entire website.


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.