Ways to view the average system load through Linux commands

Source: Internet
Author: User
Tags time interval

This article mainly introduces the Linux command to view the system average load method, for the server administrator is very useful, the need for friends can refer to the

  1, the concept of the average load of Linux systems

Sometimes we feel that the system is responding slowly, but we can't find the reason, so we need to look at the average load and see if there are a lot of processes waiting in line. The average number of processes in a running queue during a specific time interval can reflect how busy the system is, so we usually check the load of the system at the first time when our website or system slows down, that is, the average CPU load.

  2. View average load

How do you look at the average load? The simplest command is uptime, as follows:

The code is as follows:

[Root@localhost ~]# Uptime

11:31:11 up one days, 19:01, 2 users, load average:0.02, 0.01, 0.00

The current mainstream servers are double quad core, there is a very strong CPU, to do the general application services, Linux system load this is not to worry about us.

You can also use the W command to view, by the way you can see which users are currently in the system, what terminals they occupy, as follows:

The code is as follows:

[Root@localhost ~]# W

11:33:00 up one days, 19:03, 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:11m 0.04s 0.04s-bash

Root pts/2113.57.224.3 11:310.00s 0.02s 0.00s W

In addition, there is the dynamic command top, which can also reflect the system load. In the following command prompt, we only care about the bold font section.

The code is as follows:

[Root@localhost ~]# Top

top-11:37:47 up one days, 19:08, 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:4044136k Total, 1435504k used, 2608632k free, 274740k buffers

swap:8193140k total,0k used, 8193140k free, 941884k cached

What do you mean by the above bold font? And then look through the uptime.

The code is as follows:

[Root@localhost ~]# Uptime

11:39:36 up one days, 19:16, 1 user, load average:0.09, 0.03, 0.01

Originally it represents the average number of processes in the process queue in the past 1 minutes, 5 minutes, and 15 minutes.

So how do you measure whether the current system is overloaded? You can consider this from the following points.

The system performs well if the current number of active processes is not greater than 3 for each CPU (which can be calculated by the number of CPU cores).

Acceptable if the current number of active processes per CPU is not greater than 4.

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

We can also combine the Vmstat command to determine whether our system is too busy, if it is very busy, we should consider whether to replace the server or increase the number of CPUs. Summarized as follows:

If R is often greater than 3 or 4, and the ID is often less than 50, the CPU load is heavy.

In the example above, my server is the PowerEdge 2850,CPU is dual-core dual-thread, then 0.09/2=0.045 (that is, the load value/real CPU number), the system's CPU load can be largely ignored. In fact, the current mainstream server CPU is very strong, if not the application of virtualization and other special scenarios, basically the load is very small.

According to the previous calculation formula, the CPU load threshold for the Nagios alarm I configured is the number of CPU cores (that is, the physical number of CPUs x cores). Or to my server PowerEdge 2850 For example, the number of its CPU core is 2x2=4, then set the alarm value to 4. This setting is reasonable, because after all, not every application server CPU is supported by many cores, after all, there are still some weak performance of the server is used for backup.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.