views:

49

answers:

1

Hello,

After implement Hibernate Monitoring, i have noticed that hibernate execute too much query than it have on the query string table in statistics.

Screen-shots of statistics:

alt text

I think, implement hibernate 2nd level cache and particularly hibernate query cache help me to reduce this amount of query execute.

I searched on the web, on find many provider class for the cache of hibernate. But I'm not succeeded to implement it (infinispan, EhCache).

My questions are :

  • Do you think, it is the most appropriate method to reduce this amount of query execute, knowing that the query string table contains much less query ?
  • Do you have some example of implementation of this 2nd level cache with latest version of hibernate (3.5.5 final).

Thank you in advance for you help.

Best regards,

Florent,

A: 

Do you think, it is the most appropriate method to reduce this amount of query execute, knowing that the query string table contains much less query ?

It really depends on the type of application. Does the DB have trouble responding to this much queries? Adding a second-level cache on your web server will require additional ram. Do you have available ram on the web server?

Additionally, second-level cache is really useful for queries that return constants/or data that are not modified often (ex: taxes rates). Data that are modified a lot (ex. inventory) should not be put in the second-level cache.

Do you have some example of implementation of this 2nd level cache with latest version of hibernate (3.5.5 final).

What errors did you have in your implementation? There is already a lot of configurations available on the web.

Thierry-Dimitri Roy
thank you to answer, I tried to implement the infinispan cache for example so i add the library contained on the hibernate 3.5.5 package in optional folder. And I added the appropriate configuration on hibernate....xml. After this i have a classe not found exception related to jgroups library. So i added this library and again a classe not found exception but related to marshalling library in this case. To resume, the optional library in the final package of hibernate 3.5.5 don't permit to use it.
Delildor
So if you have a simple method with the library specification to integrate this second level cache. It's would help me a lot. Thank you again.
Delildor