Article Title: detailed introduction to linux performance monitoring. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Networks are the most difficult to monitor in all subsystems. First, because the network is abstract, and more importantly, many factors that affect the network are not within our control. In the introduction to Linux performance monitoring, performance tuning aims to locate system bottlenecks and adjust the system to eliminate these bottlenecks.
In Linux performance monitoring, we focus on monitoring the system at once:
1. CPU
2. Memory
3. IO
4. Network
However, these systems are dependent on each other and cannot only look at one of them. When a system is overloaded, it may cause problems of other subsystems, for example:
-> A large number of IO requests (page-in IO) read into the memory will use up the memory queue;
-> A large amount of network traffic may overload the CPU;
-> High CPU usage may be processing idle memory queues;
-> A large number of disk reads and writes consume CPU and IO resources.
The system we test can be divided into two categories:
First, IO Bound, this type of system will consume a lot of memory and the underlying storage system, it does not consume too much CPU and network resources (unless the system is network ). the IO bound system consumes CPU resources to accept IO requests and then enters the sleep state. databases are generally considered as IO bound systems.
Second, CPU Bound: these systems consume a lot of CPU resources. They often perform a lot of mathematical computing. High-throughput Web servers and Mail servers are generally considered as CPU Bound systems.
In the performance test, the first thing to do is to establish a Baseline, so that subsequent adjustments will have a reference standard. it is worth noting that the system must work normally when testing the baseline.
Common Linux performance monitoring tools include:
Tool Description
Base Repository
Vmstat all purpose performance tool
Yes
Mpstat provides statistics per CPU
No yes
Sar all purpose performance monitoring tool
No yes
Iostat provides disk statistics
No yes
Netstat provides network statistics
Yes
Dstat monitoring statistics aggregator
No in most distributions
Iptraf traffic monitoring dashboard
No yes
Ethtool reports on Ethernet interface configuration
Yes
These tools can be installed during Linux installation.
The following is an example of the baseline generated by vmstat:
# Vmstat 1
Procs memory swap io system cpu
R B swpd free buff cache si so bi bo in cs us sy wa id
1 0 138592 17932 126272 214244 0 0 1 18 109 19 2 1 96
0 0 138592 17932 126272 214244 0 0 0 105 46 0 1 0 99
0 0 138592 17932 126272 0 0 0 214244 62 40 14 0 45
0 0 138592 17932 126272 0 0 0 214244 49 0 0 117
0 0 138592 17924 126272 214244 0 0 176 220 3 4 13 80
0 0 138592 17924 126272 214244 0 0 0 358 8 17 0 75
1 0 138592 17924 126272 214244 0 0 0 368 4 24 0 72
0 0 138592 17924 126272 214244 0 0 0 352 9 12 0 79
# Vmstat 1
Procs memory swap io system cpu
R B swpd free buff cache si so bi bo in cs us sy wa id
2 0 145940 17752 118600 215592 0 1 1 18 109 19 2 1 96
2 0 145940 15856 118604 215652 0 0 468 789 86 14 0 0
2 0 146388 13764 118600 213788 0 340 340 41 87 13 0 0
2 0 147092 13788 118600 212452 0 740 1324 61 92 8 0 0
2 0 147912 13744 118192 210592 0 720 720 605 44 95 5 0 0
2 0 148452 13900 118192 209260 0 372 372 639 45 81 19 0 0
2 0 149132 13692 117824 208412 0 372 372 47 90 10 0 0