Java – how to reduce the impact of visual VM on heap usage?

I'm trying to optimize the memory usage of my application Unfortunately, use - DCOM sun. management. JMX remote runs my application and connects through visual VM. It has a great impact on heap usage At first I thought it was my application problem until I wrote a very simple program to confirm that it was really JMX overhead The following is the active image

After reading this, I began to understand that this is due to the way visual VM retrieves data, that is, applications connected through continuous polling I confirmed this by looking at the memory sampler of visual VM RMI TCP connection (n) thread allocation 180KB / s

My question is, is there any way to reduce the heap usage impact of visual VM? Changing the polling interval may not be better because I'm interested in heap information If this is not possible, can we exclude data for visual VM? At least I want to focus more on my application

Run code

Object object = new Object();
synchronized (object) {
    object.wait();
}

Heap monitor activity for visualvm

Solution

The simplest way is to reduce the polling interval The impact is proportional to the rate of data acquisition

What I do is use yourkit, which can perform all operations in native memory, so it has no impact on the heap

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>