1. Performance Monitoring Introduction
Performance optimization is the process of finding bottlenecks in the system and optimizing the operating system to eliminate these bottlenecks. Many system administrators think that performance tuning can be easily solved by reading cook book and setting some kernel parameters, but that's not the case. Performance optimization is the realization of performance balance between subsystems. These subsystems include
Cpu
Memory
/ o
Internet
These subsystems are highly interdependent. The high load of any one subsystem can easily cause problems with other subsystems. Like what
A large number of page call in I/O requests will block the memory queue
Full-load NIC will make the CPU busy
Maintaining idle memory queues can make the CPU busy
A large amount of memory written to the hard drive makes the CPU and I/O channels busy
In order to make modifications to optimize the system, it is necessary to find the place where bottlenecks occur. Sometimes a subsystem appears to be a problem, but it may be caused by the overload of other subsystems.
1.1 Determining the type of application
In order to know where to begin to optimize bottlenecks, the first point is to understand the characteristics of the system to be analyzed. The application stack for a general system is divided into two types:
I/O constraints. Application of I/O constraints requires extensive use of memory and other storage devices. The reason is that the I/O constraint application processes a large amount of data (in memory) but does not require much CPU and network resources (unless it is using a storage device on the network). An I/O constraint application uses the CPU to process I/O requests, and then generally goes into hibernation. The application of database types is generally an I/O constraint.
CPU-bound. CPU-constrained applications require a large number of CPUs, either batch processing or mathematical calculations. Large-capacity Web servers, mail servers, and other types of servers are generally CPU-bound.
1.2 Determining statistical benchmarks
System utilization efficiency depends on the administrator's experience and system specifications. The only way to verify that the system has a performance problem is to understand what the system should be optimized for, what performance should be implemented, and what the quantitative reference amount is. This would require the establishment of a reference benchmark. This benchmark statistic should be affordable for system performance, so that it can be compared with the performance that was later implemented.
The following example compares a system's baseline statistics snapshot with a snapshot of a high load
# 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-1 96
0 0 138592 17932 126272 214244 0 0 0 0 105 46 0 1-0 99
0 0 138592 17932 126272 214244 0 0 0 0 198 62 40 14-0 45
0 0 138592 17932 126272 214244 0 0 0 0 117 49 0 0-0 100
0 0 138592 17924 126272 214244 0 0 0 176 220 938 3 4-13 80
0 0 138592 17924 126272 214244 0 0 0 0 358 1522 8 17-0 75
1 0 138592 17924 126272 214244 0 0 0 0 368 1447 4 24-0 72
0 0 138592 17924 126272 214244 0 0 0 0 352 1277 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-1 96
2 0 145940 15856 118604 215652 0 0 0 468 789 108 86 14-0 0
3 0 146208 13884 118600 214640 0 360 0 360 498 71 91 9-0 0
2 0 146388 13764 118600 213788 0 340 0 340 672 41 87 13-0 0
2 0 147092 13788 118600 212452 0 740 0 1324 620 61 92 8-0 0
2 0 147360 13848 118600 211580 0 720 0 720 690 41 96 4-0 0
2 0 147912 13744 118192 210592 0 720 0 720 605 44 95 5-0 0
2 0 148452 13900 118192 209260 0 372 0 372 639 45 81 19-0 0
2 0 149132 13692 117824 208412 0 372 0 372 457 47 90 10-0 0
Compared to the last column of the number, which represents the CPU idle time ratio, we can see that, under the benchmark statistics, CPU idle time accounted for 70%-90%. In the second output, the system is fully operational without any idle time. From this we can determine whether the CPU of the system is fully utilized.
Note : More wonderful tutorials Please pay attention to the triple computer tutorial section, triple Computer group: 189034526 welcome you to join