gpt4 book ai didi

java - hibernate 监控解决方案

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:58:00 25 4
gpt4 key购买 nike

我想监控 hibernate Action 。我在互联网上看到了 zentracker 监视器解决方案,它允许监视大量 hibernate Activity 。

但是它兼容最新版本的hibernate 3.5.*?

如果不是,您是否有解决方案来监控查询执行时间、打开 sessionFactory、创建持久性对象……?

预先感谢您的帮助。

最好的问候,

佛罗伦萨

P.S:我是法国人,对不起我的英语。

最佳答案

I see on the internet the zentracker monitor solution that permit to monitor a lot of activity of hibernate. But It is compatible with the last version of hibernate 3.5.x?

为什么不获取源代码并使用更新版本的 Hibernate Core 重新编译项目?好吧,我这样做是因为我很好奇并且它没有编译,有一些 API 更改需要一些修改。但没有什么过于复杂。由于该项目似乎不是很活跃,您最好的选择是自己制作它们。

If it's not, do you have solution to monitor query execution time, sessionFactory opened, persitence object created, ... ?

好吧,就像我说的,你可以让它兼容......

我个人收集Statistics通过 JMX 并使用自定义工具。来自文档:

20.6.2. Metrics

Hibernate provides a number of metrics, from basic information to more specialized information that is only relevant in certain scenarios. All available counters are described in the Statistics interface API, in three categories:

  • Metrics related to the general Session usage, such as number of open sessions, retrieved JDBC connections, etc.
  • Metrics related to the entities, collections, queries, and caches as a whole (aka global metrics).
  • Detailed metrics related to a particular entity, collection, query or cache region.

For example, you can check the cache hit, miss, and put ratio of entities, collections and queries, and the average time a query needs. Be aware that the number of milliseconds is subject to approximation in Java. Hibernate is tied to the JVM precision and on some platforms this might only be accurate to 10 seconds.

看看Performance Monitoring using Hibernate获取更多灵感。

另见

相关问题

引用资料

关于java - hibernate 监控解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3522051/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com