如何用java分析分布式应用程序?

发布于 2024-11-02 21:04:52 字数 360 浏览 5 评论 0原文

我有一个应用程序在统一的java进程网格上运行(可能在不同的物理机器上)。我想从该应用程序的单次运行中收集 CPU 使用统计信息。我已经检查了分析工具,寻找自动收集数据的选项,但未能在 netbeans、tptp、jvisualvm、yourkit 等中找到任何选项。

也许我找错了方式?

我的想法是:

  • 使用一些特殊的设置在网格上运行进程,允许它们转储分析信息
  • 像往常一样运行我的应用程序 - 它将任务推送到网格,进程将执行任务并
  • 使用某些工具 发布分析信息收集和分析分析结果

,但我找不到任何与此类似的东西。

有什么想法、经验、建议吗?

谢谢你!

I've got an app running on a grid of uniform java processes (potentially on different physical machines). I'd like to collect cpu usage statistics from a single run of this app. I've went over profiling tools looking for an option of automatic collection of data but failed to find any in netbeans, tptp, jvisualvm, yourkit etc.

Maybe I'm looking in a wrong way?

What I was thinking is:

  • run the processes on the grid with some special setup that allows them to dump profiling info
  • run my app as usual - it will push tasks to the grid, the processes will execute the tasks and publish profiling info
  • uses some tool to collect and analyze the profiling results

but I can't find anything even remotely similar to this.

Any thoughts, experience, suggestions?

Thank you!

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

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

发布评论

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

评论(8

晨曦慕雪 2024-11-09 21:04:52

如果您已允许远程 JMX 访问并且使用的是 SUN JDK 1.6,则尝试使用 jvisualvm。它具有远程 JMX 连接选项。尽管我没有将其用于分布式环境中的 CPU 分析。

注意:对于CPU 分析,您的应用程序应在 SUN JDK 1.6 或更高版本上运行。

在此处输入图像描述

查看这些链接:

  1. JVisualVM
  2. JVisualVM - 使用远程应用程序
  3. 使用 Java 从远程应用程序获取堆转储JVisualVM
  4. 无法使用 jvisualvm 分析 JBoss 5
  5. http://www.taranfx.com/java-visualvm

If you have allowed remote JMX access and if you are using SUN JDK 1.6 then try using jvisualvm. It has the option of remote JMX connection. Though I haven't it used for profiling CPU in a distributed environment.

Note: For CPU profiling your application should be running on SUN JDK 1.6 or above.

enter image description here

Have a look at these links:

  1. JVisualVM
  2. JVisualVM - Working with Remote Applications
  3. Get heap dump from a remote application in Java using JVisualVM
  4. Unable to profile JBoss 5 using jvisualvm
  5. http://www.taranfx.com/java-visualvm
差↓一点笑了 2024-11-09 21:04:52

我已使用 CA Introscope 进行此类监控。它使用 Instrumentation 随着时间的推移收集指标。例如,它可以配置为向您提供所有节点及其随时间变化的性能的视图。从该节点视图中,您可以深入到方法级别,以帮助您找出瓶颈所在。

是的,它将提供 CPU 利用率。

它是一个商业工具,但它是收集、监控和询问性能数据的绝佳工具。

I have used CA Introscope for this type of monitoring. It uses Instrumentation to collect metrics over time. As an example, it can be configured to provide you a view of all nodes and their performance over time. From that node view, you can drill down to the method level to help you figure out where your bottle necks are.

Yes, it will provide CPU utilization.

It's a commercial $$$ tool, but its a great tool for collecting, monitoring and interrogating performance data.

少女情怀诗 2024-11-09 21:04:52

如果您查看类似 zabbix 的工具(尽管还有大量其他监控工具),您会发现它允许通过 JMX 从 Java 应用程序收集数据。如果您在应用程序中启用 JMX 并允许从外部查询(通过 TCP/IP),您将可以访问许多热点内部结构(可用内存等)以及线程堆栈等。然后您可以将这些值绘制为出色地。它确实需要配置,但您正在寻找的内容不认为可以通过一行脚本来完成。

if you look at something like zabbix (though there are tons others of monitoring tools), this allows for gathering data via JMX from a Java app. And if you enable JMX in your app and allow it to be queried externally (via TCP/IP) you will have access to a lot of the hotspot internals (free memory etc) also thread stacks etc. Then you could have these values graphed as well. It does need configuration but what you're looking for don't think can be done with a one line of a script.

兮子 2024-11-09 21:04:52

只需添加每个节点上的分析信息通常包含时间戳。

为了匹配这些时间戳,所有计算机应具有完全相同的时间(最大 10 毫秒增量),

集群节点应与单一源网络时间服务器 (NTP) 同步

Just to add that profiling information on each node usually contain timestamps.

To match these timestamps all machines should have exactly the same time (10 millis delta maximum)

cluster nodes should synchronize with single source network time server (NTP)

如此安好 2024-11-09 21:04:52

您可以使用一些 JMX 库,例如 jmxterm 并将其包装在一些代码中,以连接到多个主机并轮询它们以了解更改。如果您对 Python 有点熟悉,请查看我的简单脚本以获取一些灵感: http://rostislav-matl.blogspot.com/2011/02/monitoring-tomcat-with-jmxterm.html

You can use some JMX library, e.g. jmxterm and wrap it in some code to connect to multiple hosts an poll them for changes. If you are abit familiar with Python, look at mys simple script here for some inspiration: http://rostislav-matl.blogspot.com/2011/02/monitoring-tomcat-with-jmxterm.html .

蓝眸 2024-11-09 21:04:52

http://www.hyperic.com/products/open-source-systems-monitoring

我从未尝试过其他答案中提到的其他工具。我对 hyperic 非常满意。
它还公开了 Web 服务 API,您可以使用它来编写自己的分析工具。

http://www.hyperic.com/products/open-source-systems-monitoring

I never tried other tools mentioned in other answers. I was more than satisfied with hyperic.
It exposes webservices API as well which you can use to write your own analysis tools.

神仙妹妹 2024-11-09 21:04:52

如果您知道要分析的关键路径,我建议您在关键位置对流程进行时间戳记并自行组合日志。这可能是对您的分析的有用补充,可以在生产中使用,并且因此可能更有用。 (这是为了我的项目)

我使用 YourKit 来同时监视多个进程。它可以向您实时显示每个过程中发生的情况,并在所有操作完成后收集结果。

我不知道它是否提供了正在发生的事情的综合视图。

If you know the critical paths you want to analyse I would suggest time stamping your process in key places and combining the logs yourself. This is likely to be a useful addition to your profiling, can be used in production and may be even more useful as a result. (It is for my project)

I have used YourKit to monitor a number of processes at once. It can show you what is happening in each in real time and collect the results when all is finished.

I don't know if it provides a combined view of what is happening.

彩扇题诗 2024-11-09 21:04:52

我一直在寻找类似的东西,发现 Hyperic

声称该工具可以监控最常见的应用程序和系统,收集所有信息并以方便的方式呈现它们。

老实说,这在我的待办事项清单上,所以我不能说它是否能完成这项工作。无论如何,看起来令人印象深刻。

I was looking for something similar and found Hyperic

Claims are the tool can monitor most common applications ans systems, gather all information and present them in a conveniant fashion.

To be honest this is on my todo list, so I can't say if it will do the job or not. Anyway, it seem impressive.

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