Analyzing high CPU usage in tomcat

10,870

Solution 1

The first thing I'd try is to get a thread dump and see what's running.

From this article:

Generating Java Thread Dumps Thread Dump is generated by sending a SIGQUIT signal to the JVM process. There are different ways of sending this signal to the process.

In Unix, use "kill -3 " where pid is the Process ID of the JVM.

In Windows, press CTRL+BREAK on the window where the JVM is running

This will at least show you which threads in your applications are running, and give you a basic indication as to what's going on. jstack will provide anothe rmeans of getting this info, and is perhaps easier for server processes disconnected from the console.

A more detailed report can be obtained by using VisualVM to report on thread/CPU + memory usage.

Solution 2

Have a look at JTop, it's like unix top but for threads within a JVM.

Share:
10,870
Harish
Author by

Harish

Updated on June 07, 2022

Comments

  • Harish
    Harish almost 2 years

    I have a production system running on three tomcat servers. Suddenly one of my tomcat server is showing 100% CPU usage which I have taken out of pool.

    Can any one guide on how can I start to debug this issue? Any tools / utilities?

    Thanks, Harish

  • Christopher Schultz
    Christopher Schultz almost 12 years
    The Tomcat FAQ has a page about generating thread dumps: wiki.apache.org/tomcat/…