Hibernate 3.5.5,二级缓存配置

发布于 2024-09-15 06:45:58 字数 467 浏览 2 评论 0原文

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

统计屏幕截图:

alt text

我认为,实现 hibernate 二级缓存,特别是 hibernate 查询缓存可以帮助我减少这种情况查询执行量。

我在网上搜索了一下,发现很多hibernate缓存的provider类。但我没有成功地实现它(infinispan,EhCache)。

我的问题是:

  • 您认为,在知道查询字符串表包含更少的查询的情况下,减少查询执行量是最合适的方法吗?
  • 您是否有一些使用最新版本的 hibernate(3.5.5 Final)实现二级缓存的示例。

预先感谢您的帮助。

最好的问候,

弗洛伦特,

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,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青衫负雪 2024-09-22 06:45:58

您认为,在知道查询字符串表包含更少的查询的情况下,减少查询执行量是最合适的方法吗?

这实际上取决于应用程序的类型。数据库在响应这么多查询时是否遇到困难?在网络服务器上添加二级缓存将需要额外的内存。您的网络服务器上有可用的内存吗?

此外,二级缓存对于返回常量/或不经常修改的数据(例如:税率)的查询非常有用。修改较多的数据(例如库存)不应该放入二级缓存。

你有一些例子吗
二级缓存的实现
使用最新版本的 hibernate
(3.5.5 最终版)。

您在实施过程中遇到了哪些错误? 网络上已经有很多配置

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文