Frequent peaks of CPU, caused by unknown java process

For some hours, I experience frequent peaks in the CPU usage of my laptop, due to a java process I don't know about, even if it is run by in my session (see firt line below).

enter image description here

Peaks occur irregularly (about every 5 minutes) and last about 20 seconds. I am not doing anything special when they occur (actually typing some text in TeXstudio). It continues even after having rebooted my system.

How could I narrow down the cause of this issue?

Edit: Thanks to Andrew's answer, I've found that the peaks are cause by /proc/4146/exe -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java... but I'm not sure what triggers it.

2

4 Answers

In top, you can press c to show the whole command, then use to see more about the command, which will probably include the name of the Java class that's being executed.

Results are sorted by their CPU use (%CPU). If you want to sort results otherwise, you can run top -o <name of the colum> (e.g. top -o PID to sort by process ID, or top -o %MEM to sort processes by the amount of memory used).

You can alternatively run ps aux | fgrep java to see all running java processes.

sudo ls -l /proc/PID/exe

Will show you where it is located, which will help locate the app in question.

I spent awhile trying to track down a similar process that was using all of my CPU. If you have been using docker recently on your local machine, make sure to check whether the process that is using all your CPU is coming from docker.

sudo docker container ls` to see running containers

Run

sudo docker stop <container-name>

to stop it and

sudo docker rm <container-name>

to remove it.

I had similar issue where my CPU usage by java went more than 100%, I was running Eclipse IDE on on Ubuntu and there was build process started on Ubuntu which caused this issue.

Build process was running on background for too many files which caused java to use CPU more than 100%. when i stopped the build process it cools down and came to normal.

Then I setup a custom build settings for the project from Eclipse IDE menu

Project > Build working set > Select Working Set

now create a custom build working set and ignore the directory having too many files which you do not need to build then select that New Working Set for the project.

Hope it helps someone.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like