We have just finish to profile our application. ( she's begin to be slow ). the problem seems to be "in hibernate".
It's a legacy mapping. Who work's, and do it's job. The relational shema behind is ok too.
But some request are slow as hell.
So, we would appreciate any input on common and usual mistake made with hibernate who end up with slow response.
Exemple : Eager in place of Lazy can change dramaticly the response time....
Edit : As usual, read the manual is often a good idea. A whole chapter cover this subject here :
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/performance.html
One thing that happened at my company comes to mind. You could see if loading an entity also loads some serialized
entity, that will be deserialized every time the entity is loaded. In addition, when commiting the transaction hibernate might do a flush()
for you (is configurable). If it flushes, to maintain persistance, it will do a comparison on the entitiy committed and the one in the database. In this case it will do a comparison on the serialized
object, which takes a long time.
Another thing you could do is check if you have any unnecessary persistance cascading i.e. @Cascade({CascadeType.PERSIST, CascadeType.SAVE_UPDATE})
annotation on columns.
Another thing you could do, which is not specifically related to hibernate, is that you create view
s to do a single query, instead of doing lots and lots of queries to different tables. That made a huge difference for us on a certain feature.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With