VisualVM: Ideal Heap Memory Usage Graph

I am monitoring my Java application (written in JDK 1.7 ) using VisualVM . Following is the graph that shows heap memory usage for the duration that this application ran.

在这里输入图像描述

Looking at this graph ones see that there are a lot of spikes in it. These spikes indicate creation of objects by the application. Once the application is done with them it destroys them using gc (implicitly called in this case).

Also , here is a screenshot of memory profiler when the application is still running

在这里输入图像描述

To me the up and down nature of the graph indicates efficient usage of java objects. Is this inference right ?

What is the ideal nature of the heap usage graph that one should aim for ?

Are there any other ways that I can improve on the heap memory usage by my application ?


To me the up and down nature of the graph indicates efficient usage of java objects. Is this inference right ?

I would say its the efficient use of the garbage collector. I would suggest creating less object might be more efficient.

What is the ideal nature of the heap usage graph that one should aim for ?

That depends on your application. I tend to aim for one which is almost completely flat.

Are there any other ways that I can improve on the heap memory usage by my application ?

Loads

  • create less garbage. Use your memory profiler to find out where garbage is being created.
  • make the heap larger so it doesn't GC as often.
  • move your retained data off heap (you don't appear to have a lot)
  • In your case, the best option would be to reduce the amount of garbage you are producing.


    As long as the heap size keep almost same over time, you are ok. Used heap should go up and down due to the nature of pause the world gc in Sun JVM. Looks like lots of short lived objects are produced in your app, it may be inefficient, but sometimes you need create them. It's the lifestyle of Java :D

    链接地址: http://www.djcxy.com/p/79958.html

    上一篇: visualvm glassfish中的堆转储

    下一篇: VisualVM:理想的堆内存使用情况图