Java 1.6 JDK 工具 VisualVM
有谁用过新的Java 1.6 JDK工具VisualVM ,分析生产应用程序以及分析时应用程序的执行情况如何?
文档说它是为生产和开发使用而设计的,但根据以前的分析经验,以及其他分析工具,我很犹豫。
Has anyone used the new Java 1.6 JDK tool, VisualVM, to profile a production application and how does the application perform while being profiled?
The documentation say that it is designed for both Production and Development use, but based on previous profiling experience, with other profiling tools, I am hesitant.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
自从 VisualVM 被包含在 JDK 中之前,我就经常使用它。 它对系统性能的影响可以忽略不计。 我从来没有注意到它会导致系统性能问题,但话又说回来,我们的 Java 服务器当时有足够的空间来支持一点额外的负载。 如果您的服务器运行在完全固定的水平,无法处理 VisualVM 的运行,那么我想说您更有可能需要购买另一台服务器。 任何生产服务器都应该有一些内存空间,否则你所面临的就是一场即将发生的灾难。
I've been using VisualVM a lot since before it was included in the JDK. It has a negligable impact on the performance of the system. I've never noticed it cause a problem with performance on the system, but then again, our Java server had enough headroom at the time to support a little extra load. If your server is running at a level that is completely tacked out and can't handle the VisualVM running, then I would say its more likely that you need to buy another server . Any production server should have some memory headroom , otherwise what you have is a disaster just waiting to happen.
我已经相当广泛地使用了 VVM(VavaVoom?),在轻型模式下工作就像一个魅力,即没有分析,只是从虚拟机获取基本数据。 但是一旦你开始分析并且有很多类,那么就会出现相当大的减速。 即使您有 128 个核心板和 2 tera 内存,我也不会在生产环境中进行分析,纯粹是因为类的重新加载和重新定义很棘手,服务器类加载器是另一回事,也因服务器实现而异,在生产中干扰它们并不是一个好主意。
I have used VVM(VavaVoom?) quite extensively, works like a charm in the light mode, i.e. no profiling, just getting the basic data from the VM. But once you start profiling and there are many classes, then there is considerable slowdown. I wouldn't profile in a production environment even if you have 128 core board with 2 tera of memory purely because the reloading and re-defining of the classes is tricky, the server classloaders are another thing, also vary from one server implementation to another, interfering with them in production is not a very good idea.
对于仅监控您的应用程序,远程运行 VisualVM 不会降低太多速度。 如果系统没有处于崩溃的边缘,我还没有看到任何问题。 它基本上只是从 JVM 的粗粒度内置工具中读取信息。 但是,如果您开始分析,您将遇到与其他分析器相同的问题。 基本上是因为它们的工作方式几乎相同,通常使用 JVM 中的支持。
由于防火墙问题,许多人在远程运行 VisualVM 时遇到问题,但您甚至可以运行 通过 ssh 远程可视化虚拟机,并设置了一些系统属性。
For just monitoring your application, running VisualVM remotely should not slow it down much. If the system is not on the edge of collapsing, I still haven't seen any problems. It's basically just reading out information from the coarse grained built-in instrumentation of the JVM. If you start profiling, however, you'll have the same issues as with other profilers. Basically because they all work almost they same way, often using the support in the JVM.
Many people have problems with running VisualVM remotely, due to firewall issues, but you can even run Visual VM remotely over ssh, with some system properties set.
可以使用 VisualVM 从另一台计算机远程连接到您的服务器。 您只需右键单击“远程”节点并说“添加远程主机”。
这至少可以消除 VisualVM 开销(如果有的话)在运行时对性能的影响。
这可能无法消除所有性能问题,尤其是在生产环境中,但会有所帮助。
It is possible to remote connect to your server from a different computer using VisualVM. You just need to right click on the "Remote" node and say "Add Remote Host."
This would at least eliminate the VisualVM overhead (if there is any) from impacting performance while it is running.
This may not eliminate all performance concerns, especially in Production environments, but it will help a little.
我使用了 Net Beans 分析器,它使用与 Visual VM 相同的基础。
我正在使用较旧版本的 Weblogic,这意味着使用 1.5 JVM,因此我无法执行动态附加。 我正在分析的应用程序有数千个类,当分析器对所有类进行检测时,我的工作站几乎无法使用。 仪器安装完成后,系统运行缓慢,但并非完全无法使用。 减速的程度实际上取决于您需要捕获的内容。 基本的 CPU 指标相当轻量。 分析内存分配会大大减慢速度。
我不会在生产系统上使用它。 除了可能会降低速度之外,我最终耗尽了 PermGen 空间,因为当您更改设置时探查器会重新检测并重新加载类。 (这可能在1.6代理中修复,我不知道)
I've used the Net Beans profiler which uses the same underpinnings as Visual VM.
I was working with an older version of Weblogic, which meant using the 1.5 JVM, so I couldn't do a dynamic attach. The application I was profiling had several thousand classes and my workstation was pretty much unusable while the profiler instrumented them all. Once instrumentation was complete, the system was sluggish but not completely unusable. The amount of slowdown really depends on what you need to capture. The basic CPU metrics are pretty light weight. Profiling memory allocation slows things down a lot.
I would not use it on a production system. Aside from the potential for slowdown, I eventually ran out of PermGen space because the profiler reinstruments and reloads classes when you change settings. (This may be fixed in the 1.6 agent, I don't know)
我之前使用 VisualVM 来分析本地运行的东西。 一个巨大的胜利是我只需启动它,它就可以连接到正在运行的 JVM。 它比我以前使用过的其他分析工具更容易使用,而且似乎没有那么多开销。
我认为它可以进行采样。 CPU 密集型应用程序的开销似乎并不显着。 我没有测量任何东西(我感兴趣的是我的应用程序的性能,而不是工具的性能),但它绝对没有我习惯从分析中看到的 10 倍的减速因素。
I've used VisualVM before to profile something running locally. A big win was that I just start it up, and it can connect to the running JVM. It's easier to use than other profiling tools I've used before and didn't seem to have as much overhead.
I think it does sampling. The overhead on a CPU intensive application didn't seem significant. I didn't measure anything (I was interested in how my app performed, not how the tool performed), but it definitely didn't have the factor of 10 slowdown I'm used to seeing from profiling.
我在开发机上尝试了一下,发现当我关闭分析时,它会意外关闭 Tomcat。 我对于将其推广到生产中会非常谨慎 - 您可以在临时环境中模拟负载吗? 它不如真正的好,但如果出错的话可能不会让你被解雇......
I tried it on a dev box and found that when I turned off profiling it would shut Tomcat down unexpectedly. I'd be very cautious about rolling this out to production- can you simulate load in a staging environment instead? It's not as good as the real thing, but it probably won't get you fired if it goes wrong...
虽然我个人没有使用过 VisualVM,但我看到了这个 博客今天发布的文章可能对您有一些有用的信息。 他谈到了使用它来分析生产应用程序。
While i haven't personally used VisualVM, I saw this blog post just today that might have some useful information for you. He talks about profiling a production app using it.