File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Performance and the fly likes Heap usage increases without web-app usage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "Heap usage increases without web-app usage" Watch "Heap usage increases without web-app usage" New topic

Heap usage increases without web-app usage

Jac Jones

Joined: Jun 25, 2006
Posts: 17

I have jConsole monitoring our Tomcat v5 web-application using Suns 1.5_08 JDK.

Without any users on our web-app, what I find puzzling is that jConsole shows the heap usage going up, to then be gc'ed only to go up again - with the overall effect of the graph showing a gradual higher heap consumption. If I click the gc button in jConsole then the heap usage drops significantly - whereby the trend starts over again.

Any ideas?


Virag Saksena
Ranch Hand

Joined: Nov 27, 2005
Posts: 71
Even without active web-users, you can have other threads in the JVM creating temporary objects. As long as you are coming down to a reasonable usage after GC, you should not worry.

<a href="" target="_blank" rel="nofollow">The Peak of Performance</a>
Jeevan Philip
Ranch Hand

Joined: Nov 17, 2006
Posts: 41
Dont look at JVM memory usage unless you have reason to. Typically its the job of GC thread to watch for heap usage and execute it at regular intervals to remove unreferenced objects. So this typically results in a JVM heap usage pattern as you have mentioned.

If you are facing issues with memory like getting OOM error, then you can try tweaking the JVM heap settings if that solve the problem. In case nothing works, you may need to look at the memory usage pattern using some memory profiler tools to determine if your application is leaking memory.

As long as you practice good design and coding practices in your application development, performance tuning/monitoring should not be attempted pro-actively unless the situation warrants it. In most cases it results in unwanted efforts spend on tweaking code, without any results, and at times spoiling readability and OO-ness of the code.
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
It could even be the communication with the JConsole which is creating those objects, I suppose.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Virag Saksena
Ranch Hand

Joined: Nov 27, 2005
Posts: 71
Why don't you try disabling jConsole and running it with Auptyma JAM. Enable monitoring and see if the heap usage is still going up and down. Since JAM does not create any extra objects in the JVM, you'll be able to figure out if jconsole was creating the objects.
I agree. Here's the link:
subject: Heap usage increases without web-app usage
It's not a secret anymore!