Monitor IO performance

10.6 Monitoring IO performance

1. Monitor io performance

This iostat command is installed together when the sar command is installed, so there is no need to reinstall it. The specific usage is shown in the figure below.

The iostat command is very similar to vmstat. Enter iostat to directly view the disk display status. Enter iostat 1 to display it every 1 second. It is a dynamic command. Use ctrl + c to end the command. sda and sdb represent disks, and columns 3 and 4 represent read and write speeds. This command is not useful, because the command sar -b can also see this information.

Then introduce the command iostat -x 1

This command has a very important indicator %util, which means io waiting, all processing IO time in the statistical time, divided by the total statistical time. For example, if the statistics interval is 1 second, the device is processing IO for 0.8 seconds and idle for 0.2 seconds, then the device's %util = 0.8/1 = 80%, so this parameter implies how busy the device is. In general, if this parameter is 100%, it means that the device is running at full capacity (of course, if it is multi-disk, even if %util is 100%, because of the concurrency capability of the disk, the disk usage may not be the bottleneck).
There is also a command iotop, which needs to be installed  

yum  install iotop

The iotop command is very similar to the top command, and it is also displayed dynamically. Enter the command iotop and press Enter, as shown in the figure below.

You can see the sorting, but io has no read and write information, so there is no sorting. Press the letter q to exit.

10.7 free command

View memory usage

You can see the total memory size of the current system and the memory usage. The unit of the simple free command is KB, the unit of the -m option is M, the unit of the -g option is G, and the -h option is the intelligent display unit. Among them, the second line is the memory usage, and the third line is the swap usage. We are concerned about the data in line 2. When the system is initialized, a large part of the memory has been allocated to the cache (buff/cache). This part of the cache is used to provide the program for use at any time. If the program does not use it, then this part of the memory is used. idle. Between the CPU and the disk, the memory needs to be cached. The memory from disk to CPU is called cache, and the memory from CPU to disk is called buffer.
Formula: total=used+free+buff/cache.
available contains free and buffer/cache remainder.

10.8 ps command

The ps aux command displays all processes in the current system. It is often used together with the pipe character to view a process or its number, as shown in the following figure:

The usage of -elf is similar to that of aux, and the displayed information is basically the same

Then introduce the meaning of several parameters in the result of the ps aux command:
USER: the running user of the
process PID: the id of the process, this id is very useful, in linux, the kernel management process has to rely on the pid to identify and manage a certain program, such as me If you want to kill a certain process, you can't kill it with the pid of the kill process. You need to add a -3 option to kill -3 process pid
. Now it is assumed that the process whose PID is 476 is an illegal process. First, check the directory of the process and see See where the process is started from, which is the content of the green font in the red box in the figure below.

%CPU CPU percentage
%MEM memory percentage
VSZ virtual memory
RSS physical memory
START When to start
TIME How long to run
COMMAND command
STAT: Indicates the status of the process, the process status is divided into the following (do not require to remember, but to understand)
D can not be interrupted The process of (usually IO)
R the running process
S (capital S) has been interrupted. Usually, most of the processes in the system are processes that
have been stopped or suspended in this state T

W This seems to mean that since kernel 2.6xx, it means that there are not enough memory pages to allocate
X dead processes (this seems to never appear)
Z zombie processes, garbage processes that cannot be killed or killed, occupy the system A small resource, but it doesn't matter. If there are too many, there is a problem. Usually does not appear.
< High-priority processes, the CPU first uses
N for these processes Low-priority processes
L are locked in memory memory paging (haven’t seen them yet, just understand)
s (lowercase s) main process, generally displayed as Ss as The main process, S is the child process.
l Multithreaded process, which means that the process has multiple threads.

Summary:
iostat -x %util means all processing IO time in the statistical time, divided by the total statistical time
iostat displays the current disk usage
iostat 1 displays the disk usage every 1 second, it is a dynamic command, use ctrl + c to end the command
iotop disk usage, sorting by io
free can see the total memory size and memory usage of the current system, -m unit M, -g unit G, -h intelligent display unit
ps aux statically display all processes of the current system, Often used with |

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325002529&siteId=291194637