Okay, this has been plaguing me for the last couple of days, and it is very frustrating. I think I have determined it is an IntelliJ problem, but, I am not sure...I hope you follow along and could provide me some insight or direction...
I am developing a webapp. It's a messageboard web application. We are using Spring 1.2.5 and Hibernate 3.0.5 along with a number of other libraries. We are running the app on Resin 2.1.16 along with the Resin plugin to IntelliJ.
When we run the application normally (click Run, not Debug), the application performs as expected. Spring initializes it's context, Hibernate loads it's mapping files, and I am a happy developer. When we run the application in Debug mode though, the application is very very slow to load. The log statements trickle onto the screen, and the application takes on the order of 2 minutes to load when before it took something like 10 seconds. Also, during this slow load time, one of my processors is maxed out at 99% CPU usage. Usually, the application initialization hits more than the one processor, but in debug mode, it only hits the one.
If I just wait, the app eventually loads, but each subsequent request is still slow...especially if any database access is involved. But, that said, I don't think this is a Hibernate problem, or a Spring problem, or an webapp server problem...I will explain below...
I have run the application in Resin 2.1.16, 3.x, and on Tomcat 5.x, and the same behavior persists. Slow in Debug, fast in normal Run. I have also tried different versions of hibernate (3.0.5 and 3.1 beta 3) to the same conclusion. Spring is currently the newest release version (1.2.5) and I've not experimented changing that. I have run the app with JDK 1.4.2_08 and 1.5.0_05, and both have the same results. I have also tested running the app in IntelliJ 5.0.1 and the latest EAP (build 3512) with the same results.
Now, perhaps most interesting...if I run the app in debug mode outside of IntelliJ (ie: from the command line with “-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=7799”, as supplied by IntelliJ), the app loads like a champ. Fast and furious! Now, if I attach IntelliJ to that remote process for debugging, things immediately slow down in the same way as described above. Now, if I attach another IDE to the same process (I tried NetBeans 5.0 beta), things ran fast and normal.
So, what can I do?! Does anyone have any other steps they think I should try to debug this? JetBrains? If there is any other information I should provide, let me know.
Thanks for reading to this part. Cheers.