• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat Physcical memory usage keeps increasing and doesnt go down

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have set the JAVA options settings value for tomcat 6.0.35 as

"-Xms2048m -Xmx2048m -XX:PermSize Size=1024m -XX:MaxPermSize=1024m -XX:NewSize=512m "

Physical memory keeps increasing for every request. 70 request is coming into server at a time.

It has grown up to 2384,012K and didn't crash.

I have restarted the server when it reach 2384,012K. There was no impact to the system and I don't see any errors.

I have Java application to connect to MQ Series via MQQuemanager. It creates new connection for every request and then closes it.

Also it has JDBC connection to get details from Database.

is there any log generated by tomcat if there is a memory leak.

Please advice to validate it.

Thanks in advance
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Minoth!

Tomcat does not have a recent (and by recent I mean within about the last decade) history of runaway memory usage. So, unless someone discovers something, we'll take it as a given that Tomcat doesn't have a memory problem, one of your webapps does.

No, Tomcat does not track memory issues because Tomcat does not manage memory. That function is done by the JVM just as it is for any other Java application (or applet, for that matter).

There are many tools for monitoring and diagnosing memory issues in Java, ranging from the jconsole utility and snapshot functions packaged with the Sun/Oracle JVM up to fancy third-party commercial products.
 
Vinoth Rajendran
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,

Thanks.
I am monitoring server with java melody.

I am using tomcat 6.0.35 and JDK 1.7. Is it compatible?. Can it create an issue?




 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I forgot the exact formula to calculate how much memory the JVM will allocate, but it can be more than the "mx" and "MaxPermSize" values added up. So what you saw is perfectly normal.

By the way, a MaxPermSize of 1GB seems excessive; do you have indications that you need that much? For a web app that otherwise is content with 2GB, I'd estimate that 256MB max perm should be quite enough under normal circumstances.
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ulf is correct, and in fact if you search past history in this forum, we had a discussion about JVM memory usage not long ago. You might want to look at it.

The PermGen space starts at a default of 128M. In my experience, if you have webapps using an ORM system, that's not enough, but 256M has been good enough for me so far. PermGen memory is rather specialized and you don't need nearly as much set aside for it as you do for the stack and heap.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found the writeup a recently saw on this topic: http://plumbr.eu/blog/why-does-my-java-process-consume-more-memory-than-xmx
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is an interesting discussion on JVM memory usage, Ulf.

http://middlewaremagic.com/weblogic/?tag=eden-space
 
Vinoth Rajendran
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Thanks for the information.
I have tries tuning the JAVA options but it doesn't seems to be helping.

Physical memory always keeps increasing and the server could sustain only for a day with 2 GB.

Thanks.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you actually have a memory leak in your code? Your first post sounded like there were no problems caused by the memory consumption, but now it seems there are? Have you hooked up tools like VisualVM or JavaMonitor.com to look at what's going on?
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vinoth Rajendran wrote:Hi All,

Thanks for the information.
I have tries tuning the JAVA options but it doesn't seems to be helping.

Physical memory always keeps increasing and the server could sustain only for a day with 2 GB.

Thanks.



Changing Java's memory options is not going to magically remove bugs from application code. The best it can do is affect how long it takes before there is no more available memory. You are going to have to get the bugs out of the code.
 
A feeble attempt to tell you about our stuff that makes us money
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic