In the previous article, I gave a brief introduction to several aspects of Linux performance and how to solve them, but how do I find out from the system that something is wrong with a certain aspect or a few aspects, which requires the use of several common performance analysis tools provided by the Linux system Here is a detailed account of the use of several common performance analysis tools.
1. Vmstat command
VMSTAT is the acronym for Virtual Meomory Statistics, which is installed by default in many Linux distributions, using the Vmstat command to monitor the operating system's memory information, process status, CPU activity, and so on. The disadvantage is that a process cannot be analyzed in depth.
Vmstat uses the following syntax:
Vmstat [-v] [-n] [delay [count]]
The various options and parameters have the following meanings:
L-v: Indicates that the version information is printed and is an optional parameter.
L-n: Indicates that the output header information is displayed only once when the output is periodically cycled.
L Delay: Represents the time interval between two outputs.
L Count: The number of times that the interval is specified according to "delay". The default is 1.
For example:
Vmstat 3
Indicates that the output information is updated every 3 seconds, the output is cycled, and CTRL + C stops the output.
Vmstat 3 5
Indicates that the output information is updated every 3 seconds, and the output is stopped after 5 times.
2. Iostat command
Iostat is an abbreviation for I/O statistics (input/output statistics), and the primary function is to monitor disk I/O operations on the system. Its output mainly shows the statistics of disk read and write operations, but also gives the CPU usage. Like Vmstat, Iostat can not analyze a process in depth, only the overall situation of the system analysis.
Iostat generally do not install with the system, to use the Iostat tool, you need to install a SYSSTAT toolkit on the system, Sysstat is an open source software, the official address is Http://pagesperso-orange.fr/sebastien.godard
You can choose the source code package or RPM package installation, here is not about the installation process, installation, the system will be more than 3 orders: Iostat, SAR and Mpstat. You can then run the Iostat command directly under the system.
Iostat uses the following syntax:
Iostat [-C |-d] [-K] [-t] [-X [Device]] [interval [count]]
The various options and parameters have the following meanings:
-C: Displays CPU usage.
-D: Displays the usage of the disk.
-K: Displays data in K bytes per second.
-T: Prints the time when the statistics start executing.
-X Device: Specifies the name of the disk device to be counted, and defaults to all disk devices.
Interval: Specify two times of statistical interval;
Count: The number of times that are counted according to the time interval specified by interval.