简体   繁体   English

Java 1.6 JDK工具,VisualVM

[英]Java 1.6 JDK tool, 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? 有没有人使用新的Java 1.6 JDK工具VisualVM来分析生产应用程序以及应用程序在分析时如何执行?

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. 文档说它是为生产和开发使用而设计的,但基于以前的分析经验,使用其他分析工具,我很犹豫。

While i haven't personally used VisualVM, I saw this blog post just today that might have some useful information for you. 虽然我没有亲自使用VisualVM,但我今天看到这篇博文可能会为您提供一些有用的信息。 He talks about profiling a production app using it. 他谈到使用它来分析生产应用程序。

I tried it on a dev box and found that when I turned off profiling it would shut Tomcat down unexpectedly. 我在开发盒上尝试了它,发现当我关闭分析时,它会意外地关闭Tomcat。 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... 它不如真实的东西好,但如果出错,它可能不会让你被解雇......

I've used VisualVM before to profile something running locally. 我之前使用VisualVM来分析在本地运行的东西。 A big win was that I just start it up, and it can connect to the running JVM. 一个很大的胜利就是我只是启动它,它可以连接到正在运行的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. CPU密集型应用程序的开销似乎并不重要。 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. 我没有测量任何东西(我对我的应用程序的执行情况感兴趣,而不是工具的执行情况),但它确实没有让我从惯常分析中看到的10减速因子。

For just monitoring your application, running VisualVM remotely should not slow it down much. 为了只监视您的应用程序,远程运行VisualVM不应该减慢它的速度。 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. 它基本上只是从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. 基本上因为它们几乎以相同的方式工作,通常使用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时遇到问题,但您甚至可以通过ssh远程运行Visual VM ,并设置了一些系统属性。

I've used the Net Beans profiler which uses the same underpinnings as Visual VM. 我使用了Net Beans Profiler,它使用与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. 我正在使用旧版本的Weblogic,这意味着使用1.5 JVM,因此我无法进行动态附加。 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. 基本的CPU指标非常轻。 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. 除了可能减速之外,我最终耗尽了PermGen空间,因为当您更改设置时,探查器会重新测试并重新加载类。 (This may be fixed in the 1.6 agent, I don't know) (这可能是在1.6代理中修复的,我不知道)

It is possible to remote connect to your server from a different computer using VisualVM. 可以使用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. 这至少会消除VisualVM开销(如果有的话)在运行时影响性能。

This may not eliminate all performance concerns, especially in Production environments, but it will help a little. 这可能无法消除所有性能问题,尤其是在生产环境中,但它会有所帮助。

I've been using VisualVM a lot since before it was included in the JDK. 自从它被包含在JDK中之前,我一直在使用VisualVM。 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. 我从来没有注意到它会导致系统性能出现问题,但是我们的Java服务器当时有足够的空间来支持一些额外的负载。 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 . 如果您的服务器运行的级别已经完全解决并且无法处理运行的VisualVM,那么我会说它更有可能需要购买另一台服务器。 Any production server should have some memory headroom , otherwise what you have is a disaster just waiting to happen. 任何生产服务器都应该有一些内存空间,否则你所拥有的只是等待发生的灾难。

I have used VVM(VavaVoom?) quite extensively, works like a charm in the light mode, ie no profiling, just getting the basic data from the VM. 我已经非常广泛地使用了VVM(VavaVoom?),在轻模式下就像一个魅力,即没有分析,只是从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. 我不会在生产环境中进行分析,即使你有128核心板和2 tera内存纯粹因为重新加载和重新定义类是棘手的,服务器类加载器是另一回事,也从一个服务器实现到另一个不同在生产中干扰它们并不是一个好主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM