Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

High CPU usage in Eclipse when idle

Tags:

java

eclipse

On my multicore machine, Eclipse uses between 100 and 250 % CPU power, even when idling on a new plain install and an empty workspace. When actually doing things, it becomes slow and unresponsive.

I have tried setting the memory settings as suggested here: Eclipse uses 100 % CPU randomly . That did not help. I also tried different Java versions, namely OpenJDK and Oracle Java 7, and Eclipse versions Juno and Indigo. I am on Ubuntu 12.04 LTS.

As another maybe unrelated issue when I close Eclipse the Java process still stays open with over 200% cpu usage and needs to be killed manually.

like image 856
user1504271 Avatar asked Jul 05 '12 14:07

user1504271


People also ask

Why is my CPU usage so high on idle?

If your computer has a multi-core processor (e.g., a six-core or eight-core), you may see a high System Idle Process percent when few or no software programs are running on your computer. Also, even if programs are open, the System Idle Process can still be high if the processor is waiting for something to do.

How much CPU usage is normal for idle?

For almost CPU or OS, an average CPU percentage is below 10% at idle. This mainly depends on what apps are running on your PC. In Windows 10, if you are using a decent GPU, CPU, and SSD, the normal CPU usage is around 2% to 4% at idle.

What causes CPU spike in Java?

CPU usage might skyrocket when your application is under load, but that spike might be attributable to a system process or a misconfiguration of the software stack. If a server's virtual memory is misconfigured, page file thrashing will consume a majority of the CPU cycles.


1 Answers

I was having the same problem today, and it turned out to be an indexing thread that was occupying the CPU. I had recently added quite a bit of files to a project and had forgotten about it. I realize it's not likely that anyone else has this problem, but it might be useful to post how I investigated it.

I'm running Ubuntu 12.10 with STS based on eclipse Juno.

  1. Start eclipse from the command line and redirect output to a file so we can get a thread dump
  2. Allow it to settle for a bit, then get a listing of the cpu usage for each thread: ps -mo 'pid lwp stime time pcpu' -C java. Here's a sample of the output that identified my cpu hungry thread:

    PID LWP STIME TIME %CPU

    6974 - 07:42 00:15:51 133

    7067 07:42 00:09:49 86.1

  3. Convert the thread id (in my case 7067) to hex 0x1b9b (e.g. in the command line using: printf "0x%x\n" 7067)

  4. Do a thread dump of the java process using kill -3: kill -3 6974. The output is saved in the file you redirected stdout when you started eclipse

  5. Open the file and look for the hex id of the thread:

    "Link Indexer Delayed Write-10" prio=10 tid=0x00007f66b801a800 nid=0x1b9b runnable [0x00007f66a9e46000]

    java.lang.Thread.State: RUNNABLE

    at com.ibm.etools.references.internal.bplustree.db.ExtentManager$WriteBack.r

like image 173
Mihai Tudor Avatar answered Sep 29 '22 23:09

Mihai Tudor