I posted a message a few weeks ago about the poor performance and scalability I am experiencing with Hibernate compared to JDBC code and I am seeking advice on how to improve the performance/scalability, perhaps by tweaking the Hibernate configuration.
I have two versions of a session bean that implement the same business service API. One uses Hibernate 3 with default settings and as far as I know I have correctly followed the published advice regarding handling of sessions and transactions (see original posting for source code and configuration details). The other version of the bean uses simple JDBC DAO classes. At the moment the JDBC session bean is much more performant and scalable than the Hibernate version and I would like to understand why this is the case and what I can do about it. Both beans use the same data source and hence the same connection pooling etc. so the difference in performance must be at the persistence framework level.
Before I get the stock "pointless microbenchmark" response I will re-iterate from my original posting that this is a benchmark based on an actual application and is being tested with a real-world database (millions of rows in the key tables) and is running on dedicated test hardware - currently using 3 quad core servers; one for the test client, one for the application server (jboss) and one for the database (mysql). I originally put this benchmark together for a client that wanted advice on the most suitable persistence technology for their application.
My original post is here:
http://forum.hibernate.org/viewtopic.php?p=2362186#2362186
I would appreciate any help in understanding why Hibernate is performing so slowly for me. I'm only getting a few transactions per second with Hibernate compared with hundreds per second with JDBC. I can provide actual figures if that's useful but the key point is that the throughput with Hibernate doesn't scale linearly but it does scale linearly (near enough) with JDBC.
Do other users have experience of benchmarking Hibernate scalability versus JDBC and if so do the results match those that I am seeing?
Thanks,
Andy Grove
http://www.codesuccess.com/blog