aspose file tools*
The moose likes Tomcat and the fly likes Tomcat Memory issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat Memory issue" Watch "Tomcat Memory issue" New topic
Author

Tomcat Memory issue

PankajKumar jaiswal
Greenhorn

Joined: Aug 13, 2006
Posts: 17
Hi Friends,

We are using tomcat 6.0.16 and we are facing memory issues with it. There is only one webapp and axis2 webservice deployed on the server. The server is having 6GB RAM and we are allocating heap space of 3GB to tomcat server but still its getting memory issues.

I am providing following java options in catalina.sh



I checked with the jconsole profiler and found that the memory increases to 3GB and then suddenly drops to 1.3-1.5GB and then again increases. The CPU usage, number of threads and classes are nearly constant.

We are suspecting that memory is not getting released continuously and thats why when it reaches to Max, its forcefully calling GC and releasing all the memory(nearly 1.5 GB)

Please look into the attached profiler screenshot for more details. Can anybody help me to resolve this issue?

Regards,
Pankaj


[Thumbnail for profiler.png]

PankajKumar jaiswal
Greenhorn

Joined: Aug 13, 2006
Posts: 17
I know that using profiler adds the extra overhead and the java options for that is added just temporarily to check the performance and find out the issue.

William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
OK, exactly what is the issue? Is it crashing? Causing long delays during GC?

Isn't this exactly the behavior you would expect with Java managed GC?

Bill
PankajKumar jaiswal
Greenhorn

Joined: Aug 13, 2006
Posts: 17
I am facing this exception when the server memory usage increases...

EVERE: Socket accept failed
java.net.SocketException: Too many open files
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
at java.net.ServerSocket.implAccept(ServerSocket.java:453)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:61)
at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:310)
at java.lang.Thread.run(Thread.java:619)
Oct 15, 2009 8:20:32 AM org.apache.tomcat.util.net.JIoEndpoint$Acceptor run
SEVERE: Socket accept failed

Anybody else faced this issue?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
If I had the problem:
java.net.SocketException: Too many open files

I would be looking for files or sockets not being closed when you are through with them.

I suspect your problem has nothing to do with memory and everything to do with cleaning up after requests.

Bill
PankajKumar jaiswal
Greenhorn

Joined: Aug 13, 2006
Posts: 17
The issue is resolved when we increased the ulimit of the server from 1024 to 4096.

Thanks all to pointing me in the right direction.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Tomcat Memory issue