Linux View load

Source: Internet
Author: User

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,

$ 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 of the payload average.

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

$ top

The top command can clearly show the state of the system, and it is real-time monitoring, press Q to exit.

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.

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

Without the Iostat command, yum/apt-get install sysstat-y can

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.

Summarize:

(1) Use the top command to view the load, under Top Press "1" to see the number of CPU cores, shift+ "C" by CPU utilization size, shif+ "P" according to the memory utilization of high and low ranking;

(2) Use the iostat-x command to monitor the IO input and output is too large

--------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------

  1. Connect to a remote Linux system using the Sshclient client. Use the top command to view the current running situation of the system. A simple illustration of the results of the top command execution, with detailed explanations for each of the following.

  2. The first line of the top command, top-19:56:47 up, 3 users, Load average:0.00, 0.00, 0.00, shows the current time of the system, the time the system has been running so far, the number of users currently logged on to the system, System load (average length of the task queue) three values are 1 minutes, 5 minutes, 15 minutes ago to the current average "this three is generally less than 1, if it lasts higher than 5, please carefully check that the program affects the operation of systems" "

  3. The second line of the top command "tasks:120 Total, 2 running, 118 sleeping, 0 stopped, 0 zombie" shows the contents in turn "number of processes started", "number of running Processes", "number of pending Processes", "stopped in "Number of processes", "zombie process".

  4. The third line of the top command "CPU (s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st" displays the contents of "User space occupied CPU percentage", "Kernel space consumption CPU Percent "," process that has changed priority in user space CPU percentage "," Idle CPU percentage "," Percentage of CPU time waiting for input and output "," total time spent on CPU service for hardware interrupts "," total time spent on CPU service soft interrupt "," steal "

  5. The top command, line fourth "mem:508820k total, 480172k used, 28648k free, 41944k buffers" displays the contents in order of "amount of physical memory", "used Physical memory", "Idle Physical Memory", "kernel slow The amount of memory ".

  6. The top command, line 5th "swap:392184k Total, 0k used, 392184k free, 259152k cached" Displays the contents in order of "amount of swap area", "total used area of interaction", "Total idle swap area", "buffered intersection The total number of swap zones.

  7. The top command line 5th "PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND" is displayed in order "process ID", "Process owner", "Priority", "nice value", negative indicates high priority, positive Values represent low priority, total virtual memory used by the process, the amount of physical memory that is used by the process, the size of the non-swapped out, the shared memory size, the process state, the last update to the current CPU time consumption percentage, the percentage of physical memory used by the process, the total CPU time used by the process, command name, command line.

    Steps to read end

Linux View 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.