I am running a Java-based, multi-user web application on Tomcat 6.
For some reason, after 1 day the whole application gets really slow.
"top" says that CPU is at 120% (caused by the tomcat process) although there are not many users online, so I assume there is some kind of infinite loop (or a similar issue) going on.
On my local system, I cannot reproduce the problem.
I also cannot find out which part (which class/method) is causing the problem.
What’s the best way to debug this?
Use a profiler and see which methods are running the most (most calls or most of the time). jvisualvm is free and part of Java JDK.
If a GUI is not an option (as stated in the comment) try with hprof (http://java.sun.com/developer/technicalArticles/Programming/HPROF.html) or any command line profiler (there are many of them).
But you don’t need to run the profiler GUI on the same machine. You could run it on your machine and connect to the remote VM.