0

实施休眠监控后,我注意到休眠执行的查询比统计中的查询字符串表执行的查询多。

统计截图:

替代文字

我认为,实现休眠二级缓存,尤其是休眠查询缓存可以帮助我减少查询执行量。

我在网上搜索,找到了许多用于休眠缓存的提供程序类。但我没有成功实现它(infinispan,EhCache)。

我的问题是:

  • 你认为,在查询字符串表包含的查询少得多的情况下,减少这种查询执行量是最合适的方法吗?
  • 您是否有一些使用最新版本的休眠(3.5.5 最终版)实现此二级缓存的示例。

预先感谢您的帮助。

此致,

弗洛伦特,

4

1 回答 1

0

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.

于 2010-08-20T15:05:07.037 回答