How to troubleshoot high CPU usage on Linux?

High CPU usage is a common issue in every system, finding the root cause is not always easy.

What the sign of a high CPU usage?
I normally look at load avg , if the load avg is higher than the number of your CPU cores , then your system is overloaded.

I have 8 cores, so my number is good. Sometimes we our load avg does not reach to the cpu cores , but we still see some application is slow, it’s because there is a process occupies the one single CPU core.

My next step will be check the CPU usage per process .

with command: top

Remember that a process might have many threads, we need to find which threads are using too much CPU. I use the command below

ps -T -p 19184

I will look at 2 columns : PSID and Time

Process with long time will be mostly the process causing high CPU.


Once you know the process id , run a strace command

strace -p 19198

A bunch of stuff will be shown here. This will give you some lights to the issue.

Leave a Reply

Your email address will not be published. Required fields are marked *