Problem: My application is using too much CPU

05:07PM May 21, 2009 in category Java by Zoltan Farkas

Let's  imagine the following scenario

10. Customer informs you: "Application is not working".

20. You log in into the system, check the app processes, you see all of them there

30. you run a top or prstat and you notice one process hugging a CPU/Core way too tightly.

40 Now if you are 95% of the Engineering talent ou there you go ahead and go to step 50,  If you are me you got step 70

50 restart the application, and call it problem solved.

60 END

70. Indentify lwp (prstat -L) that is eating up the CPU.

80. get a stack trace of the process with: pstack [pid]
this way you can find the trouble call stack. if you have a java process do a:  kill -QUIT [pid]
and examine the stack trace dumped into the stderr of the process (or the file it is redirected at)

90. Get a core dump. if it is a java process you can get a full mem dump with:  jmap -dump:format=b,file=snapshot2.jmap PID_OF_PROCESS and examine th eheap with jhat or netbeans

100. if your application is already dead when you log in into the system, you can run the commands on the core file and get your truobleshoooting information including your java heap...

I solved a lot of issues using this simple technique, even identified jvm bugs ...

Comments[0]

Comments:

Post a Comment:
Comments are closed for this entry.