Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate at high volume

 
John Freshman
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(Thanks Gregg for the re-location advice...)

I have heard that Hibernate is known to really bog down e-commerce types sites that have a high volume of users hitting the db. Does anybody have a source reference for benchmarking its performance?
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,

I have heard that Hibernate is known to really bog down e-commerce types sites


I'm using Hibernate (with OSCache as the second-level cache) to build an e-commerce site. I've done some benchmarking and found the Hibernate layer to take just milliseconds to retrieve an entire graph of objects. (And my db schema is fairly complex.) Persisting objects is also extremely fast.

The benchmark program was a stand alone program I wrote to call my DAOs (Data Access Objects) repeatedly with various size result sets and calculate an average runtime. The benchmark was run with the second level cache enabled and disabled.

The benchmarking helped us identify one performance issue. Hibernate performance appears to degrade quickly when there are many (thousands) of entities in the first level cache. My theory is that Hibernate is doing dirty checking on each object before executing a query. To solve the problem, I added a session.clear() at the end of methods that retrieve large object graphs. (That worked in my case, but less drastic options might have been to evict individual objects, to call setReadOnly(true) on the query or to call session.setFlushMode(FlushMode.NEVER).)

Any technology will be slow if it's not implemented properly. Based on my experience, I think Hibernate can perform as fast as plain JDBC calls plus it provides caching and an object-oriented interface (as opposed to managing JDBC rowsets.)


Does anybody have a source reference for benchmarking its performance?


Check out the "perf" target in the Hibernate build file. It runs 3 different performance tests.

Regards,
Scott
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic