This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Heap usage increases without web-app usage

 
Jac Jones
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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?


thanks,

Jac
 
Virag Saksena
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeevan Philip
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It could even be the communication with the JConsole which is creating those objects, I suppose.
 
Virag Saksena
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic