Linux system performance analysis

The resources that need to be monitored in Linux mainly include CPU, main memory (memory), hard disk space, I/O time, network time, applications, etc.

The main factors that affect system performance are :
Factor Description
User Mode CPU Time spent by the CPU running user programs in user mode, including library calls, but excluding time spent by the kernel.
Kernel Mode CPU Time spent by the CPU running system services in kernel mode. All I/O operations require calling system services, and programmers can affect this part of the time by blocking I/O transfers.
I/O Time and Network Time Time spent responding to I/O requests and processing network connections.
Time spent in memory switching contexts and swapping data (virtual memory page import and export).
The amount of time the application program is waiting to run - the CPU is running other programs, waiting to switch to the current program.
Note: It is generally considered that the user-mode CPU and the kernel-mode CPU spend less than 70% of the time being in a good state.

The following commands can be used to monitor system performance and make adjustments accordingly:
Command description
nice Specifies the process priority when starting the program.
renice adjusts the priority of existing processes.
netstat displays various network-related information, including network connections, routing tables, interface status (Interface Statistics), masquerade connections, multicast memberships, and more. In fact, netstat is used to display statistical data related to IP, TCP, UDP and ICMP protocols, and is generally used to check the network connection of each port of the machine.
time Detects a command runtime and resource (CPU, memory, I/O, etc.) usage.
uptime View system load.
ps View the resource usage of processes in the system (instantaneous state, not dynamic monitoring).
vmstat reports virtual memory usage.
gprof accurately analyzes the performance of the program, and can give the function call time, the number of calls, the calling relationship, etc.
top monitors the resource usage of each process resource in the system in real time.
Common command combinations:
vmstat, sar, mpstat detect whether there is a CPU bottleneck;
vmstat, free to detect whether there is a memory bottleneck;
iostat detects whether there is a disk I/O bottleneck;
netstat detects if there is a network I/O bottleneck.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327051329&siteId=291194637