Using ttop in the Karaf shell to monitor the JVM performance

There’s another hidden gem in the Karaf Shell call ttop that can come in handy when monitoring the JVM performance and/or trying to isolate which threads are consuming the most CPU cycles.

I recommend running it using the following flags:

ttop --stats=tid,name,state,waited_time,waited_count,blocked_time,blocked_count,user_time,cpu_time,user_time_perc,cpu_time_perc,lock_owner_id,lock_owner_name --order=cpu_time --millis=300

You should see output like:


If you’ve identified a particular thread that’s using a lot of cycles, and would like to know exactly what it’s doing, you can using the threads command to print the stack trace i.e. threads <TID>.