For programmers, no matter what language or system program is, operation and maintenance is one of them, or even a link. But many novices are at a loss when they find that the Linux server where they are deployed occupies too much CPU after the SpringBoot project is launched online. How can we solve this problem?
What should I do if the memory usage of Linux is too high?
Average load
The average load is equal to the number of logical CPUs, which means that each CPU is just fully utilized. If the average load is greater than the number of logical CPUs, the load is heavy
Process context switch
Voluntary context switch caused by failure to obtain resources
Involuntary context switching caused by system forced scheduling
CPU utilization
The user CPU utilization rate, including the user mode CPU utilization rate (user) and the low priority user mode CPU utilization rate (nice), represents the percentage of time the CPU runs in the user mode. The user's CPU usage is high, which usually indicates that some applications are busy
The system CPU utilization rate indicates the percentage of time that the CPU runs in kernel mode (excluding interrupts). The system CPU utilization rate is high, indicating that the kernel is busy
CPU utilization rate of waiting for I/O, also known as iowait, indicates the percentage of time waiting for I/O. The iowait is high, indicating that the I/O interaction time between the system and the hardware device is relatively long
The CPU utilization rate of soft interrupt and hard interrupt respectively represents the percentage of time that the kernel calls the soft interrupt handler and the hard interrupt handler. Their high utilization rate indicates that a large number of system interrupts have occurred.
What's the matter with Linux system memory having space but not storing it?
There are two possibilities for the distribution of a large number of small files. One is that there are a large number of small files in only one or a few directories. In this case, we can use the following command to find the abnormal directory:
find / -type d -size +10M
This command is used to find out the directory whose size is greater than 10M (the larger the directory size, the more files in the directory).
The second possibility is that a large number of small files are distributed in a large number of directories. At this time, the above command may not find an abnormal directory. The following command is required:
cd /
find */ ! -type l | cut -d / -f 1 | uniq -c
This command is used to find out the total number of files in the directory. It may need to be executed several times until a specific directory is found. For example, the above command finds that there are a large number of small files in the/data directory, but there are many directories in the/data/directory. At this time, we need to continue to execute:
cd /data
find */ ! -type l | cut -d / -f 1 | uniq -c
Until you find the specific directory.
The above is about how to solve the problem of too high Linux memory occupation rate, the reason why Linux system memory has space but cannot be stored, and the correct way to handle it. I hope it can help everyone.