Profile Image
Derek

Application runs cron jobs and CPU Increased to 100%! How to identify the root cause?

Hi. This application runs cron jobs.
Cpu has gently increased steadily over a few days and has now peaked at around 100%.
Trying to identify the cause.



Report URL - https://fastthread.io/my-thread-report.jsp?p=c2hhcmVkLzIwMjEvMDIvMTcvLS10aHJlYWRkdW1wMS50eHQtLTYtMTItMjc7Oy0tdGhyZWFkZHVtcDMudHh0LS02LTEyLTI3OzstLXRocmVhZGR1bXAyLnR4dC0tNi0xMi0yNzs7LS10aHJlYWRkdW1wNC50eHQtLTYtMTItMjc7Oy0tdGhyZWFkZHVtcDUudHh0LS02LTEyLTI3

  • cronjob

  • cpu

Please Sign In or to post your comment or answer

Profile Image

Ram Lakshmanan

Hello Derek!

 

Strategic/Right approach:

 

 Inorder to accurately point the lines of code causing the CPU spike, you need to analyze not only thread dumps but also 'top -H -p {PID}' command output, where {PID} is your Java application's process Id which is experiencing 100% CPU spike. When you issue this command, it will list all the threads running in the application and amount of CPU each one of the thread consume. Once you have both the data, you can identify high CPU consuming thread and lines of code they are executing. You can either capture these artifacts and analyze them manually, or use the yCrash tool - which automatically captures  application-level data (thread dump, heap dump, Garbage Collection log) and system-level data (netstat, vmstat, iostat, top, top -H, dmesg,...). It marries these two datasets and generates an instant root cause analysis report. Here is more information on how to diagnose high CPU spike.

 

Tactical approach:

 

 In your case, fastThread tool uses it's heuristics algorithms and shows the potential threads are consuming high cpu in the section 'CPU consuming threads'. 

 

 I could see there are few Quartz scheduler threads making backend DB calls through Hibernate and doing lot regular expression activity. In general both hibernate and regular expression activities consume lot of CPU. But we wouldn't be able to tell exactly how much CPU those threads are consuming (because of lack of 'top -H -p {PID}' output. Below is the excerpt from your report, showing the CPU consuming threads:

 

 

Profile Image

Derek

I see.
This is really helpful, thank you.
Unfortunately, in a panic, we restarted the server, so cpu usage is now low.
But we know it will creep up again over the next week, and when it does I'll be ready for a proper strategic investigation.
Thanks again Ram

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • cronjob

  • cpu