Linux View Machine Load __linux

Source: Internet
Author: User
Tags memory usage switches time interval 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 load is high, mainly due to CPU usage, memory usage, IO consumption of three components. Excessive use of any item will result in a sharp rise in server load.

There are a variety of commands to view the server load, W or uptime can display the load directly,

$ uptime
12:20:30 up, 21:46,  2 users,  load average:8.99, 7.55, 5.40
$ w
12: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 on average.

What is load. What is load Average?

Load is the measure of how much you work on your computer (wikipedia:the system Load is a measure of the amount of work that a compute system is doing) simply the length of the process queue Degree. Load Average is the average load for a period of time (1 minutes, 5 minutes, 15 minutes)

How to determine if the system has over Load
For the general system, according to the number of CPUs to judge. If the average load is always below 1.2, and you have 2 cup machines. So basically does not have the CPU insufficient use situation. That is, the load average is less than the number of CPUs, generally based on the 15-minute load average for first.

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

$top

The tasks line shows the current total number of processes and their status, pay attention to zombie, indicating that the zombie process, not 0, indicates that there is a process problem.

The CPU (s) line shows the current CPU state, US indicates that the user process is CPU-intensive, SY indicates that the kernel process is CPU-intensive, the ID represents the free CPU percentage, and WA represents the percentage of CPU time that the IO wait takes. WA occupies more than 30% means IO pressure is very high.

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

Swap line with the Mem line, cached represents the cache, the user has opened the file. If the used of swap is high, the system is low on memory.

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

Generally speaking, the reasonable load of the server is the CPU kernel number *2. In other words, for the 8-core CPU, the load within 16 indicates that the machine runs very stable and smooth. If the load is more than 16, it indicates that the server is running a certain amount of pressure.

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

Simply having the top command is not enough because it only shows CPU and memory usage, and there is another important reason why the load is--io not clearly demonstrated. Linux provides the Iostat command to understand the cost of IO.

Enter the Iostat-x 1 10 command to start monitoring the input and output status, x indicates all parameter information, 1 is monitored every 1 seconds, 10 is monitored 10 times.

Where rsec/s is read in, WSEC/S is written every second, and these two parameters, at a particularly high time, represent a great pressure on disk io, util for IO usage, and if it's close to 100%, it says IO is running at full capacity.

View System Load Vmstat

$vmstat
procs-----------memory-------------Swap-------io-----system--------CPU-----
r b swpd free buff Cache si so bi bo in CS us sy ID WA St
0 0 0 689568 121068 1397252 0 0 77 8 110 745 4 1 93 1

The R column represents the number of processes running and waiting for the CPU time slice, if longer than 1, indicating that the CPU is low and needs to be increased.
Column B indicates the number of processes waiting on the resource, such as waiting for I/O, or memory swapping. CPU indicates the CPU usage state
The US column shows the percentage of CPU time spent in user mode. US is a high value, indicating that the user process consumes more CPU time, but if it is longer than 50%, you need to consider optimizing the user's program.
The SY column shows the percentage of CPU time spent by the kernel process. The reference value for us + sy is 80%, and if Us+sy is greater than 80%, there may be a lack of CPU.
The WA column shows the percentage of CPU time that the IO wait takes. The reference value for WA is 30%, and if WA exceeds 30%, the IO wait is serious, possibly due to a large amount of random access to the disk or the bandwidth bottleneck of the disk or disk access controller (mostly block operations).
The ID column shows the percentage of time that the CPU is idle, system displays the number of interrupts that occurred during the collection interval
The in column represents the number of device interrupts per second observed during a time interval. The CS column represents the number of context switches generated per second, such as when CS is much higher than disk I/O and network packet rates, and should be investigated further.
Memory
The amount of memory that SWPD switches to the memory Swap area (k). If the value of SWPD is not 0, or relatively large, such as over 100m, as long as SI, so the value of long-term 0, system performance is still normal
Free the current list of idle pages of memory (k) Buff as buffer cache memory amount, generally to the block device to read and write only need to buffer. Cache: As page cache of memory, generally as a file system cache, if the cache is larger, indicating that the cache used more files, if the IO in the bi relatively small, indicating file system efficiency is better. Swap
Si by memory into the memory swap area number. So from the memory swap area into the amount of memory. Io
The total amount of data that bi reads from a block device (read disk) (KB per second). The total amount of data written by a Bo block device (write disk) (KB per second)
Here we set the Bi+bo reference value of 1000, if more than 1000, and the WA value should be considered balanced disk load, can be combined with iostat output to analyze

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.