Linux View machine load

Source: Internet
Author: User
Tags cpu usage

Load is an important indicator of the Linux machine, which intuitively reflects the current state of the machine. If the machine load is too high, then the operation of the machine will be difficult.

Linux has a high load, mainly due to CPU use, memory usage, IO Consumption is composed of three parts. Any one use too much, will lead to a sharp rise in server load.

There are several commands to view server load, W or uptime can directly display the load,

$ uptime12:20:30 up, 21:46,  2 users,  load average:8.99, 7.55, 5.40
$ w12:22:02 up, 21:48,  2 users,  load average:3.96, 6.28, 5.16

The load average corresponds to the last 1 minutes, 5 minutes, and 15 minutes of the payload average.

What is load? What is load Average?

Load is a measure of how much a computer is working (wikipedia:the system load is a measure of the amount of work, a compute system is doing), which is simply a long process queue Degree. Load Average is the average load in a period of time (1 minutes, 5 minutes, 15 minutes)

How to tell if the system has over Load
For the general system, according to the number of CPU to judge. If the average load is always below 1.2, and you have 2 cups of machines. There is not enough CPU usage. That is, the load average is less than the number of CPUs, usually based on the 15-minute load average of the first.

These two commands simply reflect the load, and Linux provides a more powerful and useful top command to view the server load.

$top

The tasks line shows the total number of processes and the status of the current process, note that zombie, which represents a zombie process, does not have a 0 indication of a process problem.

The CPU (s) line shows the state of the current CPU, which means that the user process consumes CPU scale, SY indicates that the kernel process consumes CPU, the ID represents the percentage of idle CPU, and WA represents the percentage of CPU time that IO waits. WA occupies more than 30%, which means the IO pressure is very high .

The MEM line shows the current state of the memory, total is the overall memory size, userd is used, free is the rest, and buffers is the directory cache.

Swap lines with the Mem line, cached represents the cache, the user has opened the file. if the used of the swap is high, it indicates that the system is running out of memory .

Under the top command, press 1 to show how much CPU the server has and how each CPU is used

In general, the server's reasonable load is CPU core count. This means that for a 8-core CPU, the load within 16 indicates that the machine is running stably and smoothly. If the load exceeds 16, it indicates that the server is running with some pressure.

Under the top command, press SHIFT + "C" to sort the process according to CPU utilization from large to small , press shift+ "P", then sort the process by memory usage from large to small , it is easy to locate which services consume higher CPU and memory.

Just having the top command is not enough, because it only shows CPU and memory usage, and there is no clear display of--io for another important reason for the load to rise. Linux provides the Iostat command to understand the overhead of IO.

Input iostat-x 1 command to start monitoring input and output status,-x to display all parameter information, 1 to monitor every 1 seconds, 10 for total monitoring 10 times .

Where rsec/s is read, wsec/s represents write per second, the two parameters of a particularly high time to indicate that disk IO has a lot of pressure, util represents IO utilization, if close to 100%, indicating IO full load operation.

View System Load Vmstat

$vmstatprocs-----------Memory-------------Swap-------io-----system--------CPU-----r B swpd free buff cache si so bi b O in CS us sy ID WA st0 0 0 689568 121068 1397252 0 0 77 8 110 745 4 1 93 1 0

RColumn represents the number of processes running and waiting for CPU time slices, if the long term is greater than 1, the CPU is not sufficient and needs to be increased.
bColumns represent the number of processes waiting on a resource, such as waiting for I/O, or memory swapping. CPU indicates usage status of CPU
USThe column shows the percentage of CPU time that is spent in user mode. When the value of us is higher, the user process consumes more CPU time, but if the long-term is greater than 50%, you need to consider optimizing the user's program.
SyThe column shows the percentage of CPU time that the kernel process spends. Here US + SY reference value is 80%, if us+sy greater than 80% indicates that there may be insufficient CPU.
WAThe column shows the percentage of CPU time that the IO wait takes. Here WA has a reference value of 30%, if WA is more than 30%, it indicates that the IO wait is serious, this may be caused by a lot of random access to disk, or the bandwidth bottleneck of disk or disk access controller (mainly block operation).
IDColumn shows the percentage of time that the CPU is idle when the system displays the number of interrupts that occurred during the acquisition interval
inchColumn represents the number of device interrupts per second observed in a time interval. The CS column represents the number of context switches produced per second, such as when CS is much higher than disk I/O and network packet rates, and should be investigated further.
Memory
SWPDThe amount of memory that is switched to the memory Swap area (k). If the value of SWPD is not 0, or larger, for example, more than 100m, as long as SI, so the value of long-term 0, system performance or normal
FreeThe amount of memory in the current free page list (k) The buff acts as the amount of memory in the buffer cache, which is generally required to read and write to the block device. Cache: As the number of memory page cache, generally as the file system cache, if the cache is large, indicating that the file with the cache is more, if at this time bi is relatively small in Io, the file system efficiency is better. Swap
siThe number of memory swap areas entered by memory. So the memory swap area enters the amount of memory. Io
BiThe total amount of data read from the block device (read disk) (KB per second). The total amount of data written by the BO block device (write disk) (KB per second)
Here we set the Bi+bo reference value of 1000, if more than 1000, and the large WA value should consider a balanced disk load, can be combined with the Iostat output to analyze

Linux View machine load

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.