This document describes how to troubleshoot and handle Linux CVM login failures due to high CPU or memory usage.
Hardware, system processes, business processes, and trojans may cause high CPU or memory usage, resulting in slow service response or CVM login failure. You can use Cloud Monitor to create an alarm threshold for CPU or memory usage. Then, you will be notified promptly when the configured threshold is exceeded.
Top: A monitoring tool on Linux commonly used to obtain the CPU or memory usage by process. The output information of the
top command is as shown below:
top command output consists of two parts. The upper part displays the general usage of CPU and memory resources:
The lower part displays the resource usage by process:
Select a CVM login method based on your actual needs.
If the Linux CVM instance has a high CPU load, the login may fail.
If the Linux CVM instance has a high CPU load, you can log in to it in the console.
Run the following command to view the system load. View the %CPU and %MEM columns and identify which processes consume more resources.
Analyze the processes on the Task Manager page to troubleshoot and solve the problem.
kill PID 23 with signal :appears after you press Enter, press Enter again to keep the default settings.
Send PID 23 signal [15/sigterm]will appear. Press Enter to confirm the termination.
The load average is an indicator of CPU load. The higher the load average, the longer the queue of pending processes is.
top command is executed, information similar to the following is returned, indicating that the CPU usage is low but the load average is very high.
Run the following command to check whether any process is in the D state as shown below:
If there are many processes in the D state, restore the resources on which the processes depend or restart the operating system.Note
The D state refers to the uninterrupted sleep state. A process in this state cannot be terminated nor can it be exited by itself.
Linux manages memory by using the pagination mechanism and sets aside a portion of the disk as virtual memory. kswapd0 is the process responsible for page replacement in the virtual memory management of the Linux system. When system memory becomes insufficient, kswapd0 will frequently replace pages, which will result in high CPU usage.
Run the following command and find the kswapd0 process.
Check the state of the kswapd0 process.
If the process is not in the D state and has been running for a long time and consuming too many CPU resources, perform step 3 to check the memory usage.
Run commands such as
ps to check how much memory is used by processes in the system.
Based on the memory usage, restart the system or terminate safe but unnecessary processes. If the
so values are also high, pages are frequently replaced in the system. If the physical memory of the current system can no longer meet your requirements, consider upgrading your system memory.