您在生产 Java 应用程序中使用 JMX 监视什么?

发布于 2024-08-10 08:24:54 字数 178 浏览 3 评论 0原文

这个问题不是关于 JMX 如何工作或 JMX 做什么的。这个问题是关于JMX在生产中标准应用服务器环境中的应用。它也不适用于特定服务器。

在运行标准 Java EE 服务堆栈的生产环境中,您使用 JMX 监视什么:数据库访问(JDBC 和 JPA)、会话 EJB、JMS、Web 服务器、Web 服务、支持 AJAX 的服务?

This question is not about how JMX works or what JMX does. This question is about applications of JMX in a standard application server environment in production. It is not for specific server either.

What do you monitor with JMX in production environment that runs standard stack of Java EE services: database access (JDBC and JPA), session EJBs, JMS, web server, web services, AJAX-enabled services?

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

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

发布评论

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

评论(5

做个少女永远怀春 2024-08-17 08:24:54

JVM 级别,我监控每分钟的垃圾收集持续时间,

Servlet Container 级别,我监控请求数、异常数(4xx 和 5xx 代码) ) ,每分钟请求持续时间的总和,

SOAP 级别,我监控调用次数、异常次数和请求次数。每个操作和每分钟的调用总数,

Web MVC框架级别,我监视调用次数、异常数和异常数。每个操作和每分钟的调用总和,

对于池(数据源、线程池/执行器服务),我监视活动计数,

对于 JMS 连接,我监视发送数量&每分钟接收的消息数,以及活动接收者的数量,

对于EhCache,我监控缓存中的条目数、命中数和接收者数。每分钟未命中数,

业务应用级别,我开发了一个@Profiled注解来监控每分钟的调用次数、异常次数和总持续时间。

如果您对此类指标感兴趣,我们开发了许多 JMX 附加功能(dbcp、util.concurrent、jms、@profiled 注释),并将所有这些与基于 Spring XML 命名空间的配置、Hyperic HQ 插件、监控 jsp 页面等打包在一起

。在这里:http://code.google.com/p/xebia-france/维基/XebiaManagementExtras

所有这些代码均根据商业友好的开源 Apache 软件许可证 2 获得许可,部署在 Maven 中央存储库上,可作为 jar 下载,并可在 Google Code Subversion 服务器上以您想要的方式集成。

希望这有帮助,

Cyrille (Xebia)

At the JVM level, I monitor the garbage collection duration per minute,

At the Servlet Container level, I monitor the number of requests, number of exceptions (4xx & 5xx codes) , sum of request duration per minute,

At the SOAP level, I monitor the number of invocations, number of exceptions & sum of invocations per operation and per minute,

At the Web MVC Framework level, I monitor the number of invocations, number of exceptions & sum of invocations per action and per minute,

For the pools (datasource,thread pool / executor service), I monitor the active count,

For the JMS connections, I monitor the number of sent & received messages per minute, and the number of active receivers,

For EhCache, I monitor the number of entries in the cache, the number of hits & miss per minute,

At the business application level, I developped an @Profiled annotation to monitor the number of invocations, number of exceptions and total duration per minute.

If you are interested in such kind of metrics, we developed many JMX extras (dbcp, util.concurrent, jms, @profiled annotation) and packaged all this with Spring XML namespace based configuration, Hyperic HQ plugins, monitoring jsp pages, etc

The details are here : http://code.google.com/p/xebia-france/wiki/XebiaManagementExtras .

All this code is licensed under the business friendly Open Source Apache Software License 2, deployed on Maven Central Repository, downloadable as a jar and available on a Google Code Subversion server to be integrated the way you want.

Hope this helps,

Cyrille (Xebia)

二智少女猫性小仙女 2024-08-17 08:24:54

我使用 JMX 公开了一个 MBean,该 MBean 允许动态调整 Log4J Logger 级别。事实证明,这对于集群应用程序非常有用,我们不想在所有节点上修改 log4j 配置文件来更改指定记录器的日志级别。

I've used JMX to expose an MBean that will allow the adjusting of the Log4J Logger levels dynamically. This proved to be very useful for a clustered application where we did not want to have to modify the log4j configuration file on all nodes to change the log level for a specified logger.

酒中人 2024-08-17 08:24:54

我最常见的要求是监视线程计数和内存。我最近的工作涉及向网格调度大量线程的服务器,监视线程使用情况(衡量服务器正在执行多少调度工作的度量)非常重要。内存与线程使用密切相关(部分是因为与每个线程关联的对象,部分是因为每个线程的隐式堆栈分配)。

我们还启用了 JMX 工作负载队列数据。上面监控了排队工作项的症状影响,但最终我们希望监控实际的工作队列。为了更清楚地了解正在发生的事情,通过 JMX 公开关键组件是值得的。

My most common requirement is monitoring thread counts and memory. My most recent work involved heavily-threaded servers dispatching to grids, and it was important to monitor thread usage (a measure of how much dispatch work the server was undertaking). Memory is closely tied to the thread usage (partly because of the objects associated with each thread, partly because of the implicit stack allocation per thread).

We JMX-enabled our workload queue data as well. The above monitored symptoms or effects of queuing work items, but ultimately we wanted to monitor the actual queues of work. It's worthwhile to expose key components via JMX to get a clearer perspective on what's going on.

手长情犹 2024-08-17 08:24:54

在之前的项目中,我们监控了线程计数和内存、HTTP 会话数量以及查询缓存的大小。 JMX 与缓存的另一个好处是您可以强制刷新。

On a previous project, we monitored thread counts and memory, number of HTTP sessions and size of query caches. The other interest of JMX with caches is that you can force a flush.

很酷又爱笑 2024-08-17 08:24:54

有点 OT,但您可以使用 JMX 做更多的事情。目前我正在使用 JMX 来热部署/热修复组件。动态向现有组件添加功能(过滤器等)。 JMX 非常适合同一 JVM 上的组件之间的通信。我创建的每个组件都经过检测以使用 JMX。

A little OT but you can use JMX for quite a bit more. Currently I am using JMX to hot deploy / hot fix components. Dynamically add functionality to existing components (filter, etc.). JMX is good for communication between components on the same JVM. Every component I create is instrumented to use JMX.

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