High CPU in "VM Thread" in Java application

Solution Unverified - Updated

Environment

  • OpenJDK
  • Oracle JDK

Issue

  • My Java application is using a lot of CPU time, and there is a single thread called "VM Thread" that is using ~100% cpu. Why is this occurring?

Resolution

Inspect the GC logging and heap dump to determine if the excessive GC is due to an undersized heap or unintended object retention.

Root Cause

The high cpu is due to garbage collection or another JVM operation that requires a safepoint: Deoptimization, PrintThreads, PrintJNI, FindDeadlock, ThreadDump, EnableBiasLocking, RevokeBias, HeapDumper, GetAllStackTrace.

Diagnostic Steps

Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.