I am currently profiling an app deployed on a JBoss 4.2.3 with an underlying MySQL database.
Basically all stack traces where time is spent boil down to the following:
-> our stuff
--> some Hibernate method time spent so far: 1%
----> org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery() time spent in this method: 95%
-------> net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery() time spent in this method: 4%
The interesting thing now is that 95% of the time is spent in WrappedPreparedStatement, BUT ONLY 4% in JtdsPreparedStatement.executeQuery().
So it looks as if 95% of the time is spent inside Jboss and only 4% in the actual query to the database!!!
This also complies with the observation that our application is terribly slow, but the database load is still quite low.
My profiler does not profile into Jboss, so I debugged into org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery() to see where this time could have been spent and I have the suspicion it is in the synchronized(stateLock) block of the following method (called from WrappedPreparedStatement.executeQuery()):
Does anyone have an idea what we might be doing wrong? Or what causes this strange behaviour?
Any help is highly appreciated!