I'm using Hibernate 3.2 with Spring, with OpenSessionInViewFilter building a session for each request. Everything is working properly.
However, as I began to performanc-tune the application, I noticed that a lot of threads were blocked trying to return JDBC connections to the pool (DBCP, under Tomcat). Looking at thread dumps showed that many of these returns are inside my business logic, rather than during OSIV completion. They seem to occur durring the commit of a sub-transaction executed as part of my business logic. Presumably the next txn grabs a new connection from the pool.
Again, this works correctly, but it appears that all that extra pool activity is the current bottleneck on scaling my app. It seems to me that it would work just as well if the Hibernate session held onto a single connection for all its work during the full lifetime of the session.
Am I wrong about this? Or is there a way to make that happen?
|