permaculture playing cards*
The moose likes Tomcat and the fly likes Tomcat Physcical memory usage keeps increasing and doesnt go down Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat Physcical memory usage keeps increasing and doesnt go down" Watch "Tomcat Physcical memory usage keeps increasing and doesnt go down" New topic
Author

Tomcat Physcical memory usage keeps increasing and doesnt go down

Vinoth Rajendran
Greenhorn

Joined: Apr 20, 2011
Posts: 9
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
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15961
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Vinoth Rajendran
Greenhorn

Joined: Apr 20, 2011
Posts: 9
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?




Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41150
    
  45
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.


Ping & DNS - my free Android networking tools app
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15961
    
  19

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
Marshal

Joined: Mar 22, 2005
Posts: 41150
    
  45
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

Joined: Jun 25, 2001
Posts: 15961
    
  19

Here is an interesting discussion on JVM memory usage, Ulf.

http://middlewaremagic.com/weblogic/?tag=eden-space
Vinoth Rajendran
Greenhorn

Joined: Apr 20, 2011
Posts: 9
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
Marshal

Joined: Mar 22, 2005
Posts: 41150
    
  45
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

Joined: Jun 25, 2001
Posts: 15961
    
  19

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat Physcical memory usage keeps increasing and doesnt go down
 
Similar Threads
Java Private Bytes Increase
running tomcat in linux for production
Weblogic OutOfMemory
tomcat on linux - memory consumption
Out of Memory/ Command.process