In the test development process linux system environment, we often need to evaluate system performance, especially in the performance testing process, we need to monitor system resources to analyze performance bottlenecks positioning system.
First of all, we need to know what good or bad performance from latitude to evaluate the system:
- CPU utilization and load
- Memory Usage
- Disk I / O utilization
- Network utilization
How to monitor usage of system resources above it, which it commonly used commands and tools. Here, we give you a list of a few of the most common work performance monitoring tools and commands, hoping to help everyone work.
1.vmstat
It stands for Virtual Meomory Statistics (virtual memory statistics), on the linux memory, processes, and CPU activity monitor, only the overall situation of the system statistics.
Common parameters:
-s: display memory-related statistics,
-a: display active and inactive memory
-d: show disk-related statistics
-t: Display Time
2.top
top is a powerful performance monitoring tools, linux user is the most commonly used system commands, similar to the role of task manager windows system. Status can run real-time monitoring system, the main display system resource usage of each process, and sorted according to the cpu and memory.
Common parameters:
-d: set the refresh time
-p: Specifies the process
3.iostat
I / O (input and output) statistics on the system disk monitoring, statistical information output disk reads and writes, only a holistic approach.
Common parameters
-c: show CPU usage
-d: display disk usage
4.netstat
netstat command for each port of the network connection to display IP, TCP, UDP and ICMP statistics related inspection machine.
Common parameters:
-a: Show all connections socket information.
-t: Display all TCP connection information
-u: Show all UDP connection information
-p: PID display and the name of your process socket
5.sar
sar system activity reports (System Activity Reporter) is a very comprehensive system monitoring command, you can obtain information system's CPU, memory, process activity, system calls and so on.
Common parameters:
-u: Display the status of all loads in the sampling time of the CPU
-r: Statistical information output memory and swap space
-b: the sampling time buffer usage
-n: Displays the network operating status
-d: disk usage time of the sampling device
-q: the size of the run queue
6.nmon
Nmon is a computer system performance monitoring tools, because it free, small size, simple installation, low resource consumption, is widely used in AIX and Linux systems. . Requires a separate installation, there are many online installation process, there is not much to say.
After entering nmon, the following command can be used
c: the display information of the CPU
m: memory information
n: Network System
d: disk information
t: process information system
Common parameters:
-s: once every n seconds, sampling
-c: How many number of samples taken
-f: according to the standard format of the output file name YYMMDD_HHMM.nmon
Save the file directory specified statistics: -m
nmon -s1 -c60 -f -m /home/nmon
Nmon Analyzer can use data collected for a visual nmon Excel chart, as follows:
7.dstat
Multifunction system resource statistics generation tools need to be installed separately. Integrated function, the output with the color information vmstat **, ** iostat and ifstat three kinds of commands, the overall situation is more clear display system.
Common parameters:
- -c: display system CPU occupancy
- -d: Displays disk read and write data size.
- -n: display network status.
- -m: display memory usage.
- -p: display process status.
- -s: display swap usage.
- -r: I / O request situation.
As used in accordance with the general classification performance tool selection, sometimes with the need to use several commands, using the command selection you can refer to FIG.
Finally, for everyone to put together a set of three T linux resources from basic to advanced programming, focusing on the background [Wu Fei] reply with "linux" get. Python resources for additional testing and reply "Information" get.