jVisualVM中采样和分析的区别

2022-01-16 00:00:00 jvm java heap-memory jvisualvm

VisualVM 有两个单独的选项卡用于采样和分析.VisualVM 中的采样和分析有​​什么区别?

VisualVM has two separate tabs for sampling and profiling. What is the difference between sampling and profiling in VisualVM?

推荐答案

Sampling 意味着进行大量线程转储并分析堆栈跟踪.这通常更快,不需要在您的字节码中进行运行时更改(这可能会破坏它),但也不太准确.

Sampling means taking lots of thread dumps and analyzing stack traces. This is usually faster, does not require runtime changes in your bytecode (which may break it), but is also less accurate.

Profiling 表示 检测你的类和方法,所以他们报告"每当他们运行.这更准确,因为它计算每次检测方法的调用,而不仅仅是在转储完成时捕获的那些.然而检测意味着你的类的字节码被改变了,这可能会破坏你的程序.实际上,出于这个原因,在大型应用程序服务器(如 JBoss 或 WebLogic)上使用分析通常会导致一切死机或挂起.

Profiling means instrumenting your classes and methods, so they "report" whenever they are run. This is more accurate, as it counts every invocation of instrumented method, not only those caught when the dump is done. However instrumentation means that the bytecode of your classes is changed, and this may break your program. Actually, for that reason, using profiling on large application servers (like JBoss, or WebLogic) often causes everything to die or hang.

相关文章