How to troubleshoot high CPU in Linux

Home > Search > How-to
  by

The top and sar commands are your best friends when attempting to determine what processes are using the majority of the CPU. Typically, folks use top first, and top may be able to easily spot the process that is using the majority of the CPU. In this example, the Java process is using 90% of the CPU. If the top command does not easily spot the process that is using the majority of the CPU, the sar command may be helpful.

[root@server1 ]# top
. . .
PID    User   PR  NI     VIRT     RES     SHR   S  %CPU  %MEM    TIME+   COMMANDS
4594   root   20   0   417768  144754    5803   S  90.0   5.2  0:41:49       Java
. . .

 

One common cause of high CPU is a cron job that runs commands that cause high CPU. Check your cron table (crontab) to see if a scheduled job correlates to the tip when there is high CPU. For example, perhaps a crontab job is creating gzip or bzip2 compressed archives of a certain directory, such as /etc, which would cause high CPU while the job is running.

Another cause of high CPU is an application that is doing something to use a lot of CPU. For example, if you have a web server (apache httpd ngnix) or an application server (tomcat websphere) installed on the system, the web app may be using excessive CPU.



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments