How to troubleshoot high system load in Linux operating system?
When the load on a Linux system is too high, you can troubleshoot using the following steps:
- Use the top or htop command to check the system’s load. The first line of the load information displays three numbers representing the system load for 1 minute, 5 minutes, and 15 minutes. If these numbers exceed 70-80% of the number of CPU cores, it can be considered as high system load.
- Use the top command to check CPU usage. Press the 1 key to display detailed usage for each CPU core. Identify which process is consuming a significant amount of CPU resources.
- Use the “ps aux” command to view the list of processes in the system, and sort them by CPU usage or memory usage to identify processes that are consuming a significant amount of resources.
- Use the top command to check the memory usage. Press the M key to sort by memory usage rate and see which process is consuming a lot of memory resources.
- Check the system’s free and used memory using the command free -h.
- Check the size of files and directories using the command “du -sh *” to see if there are any files or directories taking up a significant amount of storage space.
- Use the command netstat -an | grep ESTABLISHED to check the system’s network connections and see if there are a large number of connections using up system resources.
- Check the system log files at /var/log/messages or /var/log/syslog for any abnormal errors or warning messages.
These are some common troubleshooting methods that can be adjusted and expanded based on the specific situation. If the issue cannot be found, consider using other performance analysis tools like perf and strace. Additionally, refer to relevant system performance optimization manuals and documents for more detailed troubleshooting and solutions.