tags:

views:

32

answers:

1

Hi!

I am responsible to maintain one server running a J2EE web application. Jboss 4.0 is used as servlet container and the JVM is started with memory enough to run the application (I think):

if [ "x$JAVA_OPTS" = "x" ]; then JAVA_OPTS="-server -Xms1500m -Xmx1500m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000" fi

I have to restart jboss everyday because the java process starts to use a lot of memory, so the application runs very slow.

I would just like to know if It could be a problem of design or a problem of jboss configuration.

PD: I know I wrote only a few details, but that's what I have.

Thanks.

A: 

There is no fundamental problem with using a lot of memory. If the VM size is too large and you create a lot of objects that need to be garbage collected, you will need to do a GC more often, which means a full GC more often. A full GC on a really large VM can cause "freezes" of up to seconds. For some applications this can be a real problem. In others maybe not.

You want to track the VM size over time and any profiler will do this. VisualVM ships with Java 6u14 (iirc) or higher and it'll do it. If you watch your application over time you'll see the amount of memory go up and then drop suddenly as temporary objects are garbage collected forming a "saw" pattern.

Now over time that may go up (ie the overall slope is up). This may or may not indicate a problem. It could indicate you're leaking memory. It could mean you're holding references onto objects you simply don't need to so they aren't being GCed. Or it could be no problem at all. It depends on what you're application is doing. If, for example, you're caching a larger and larger amount of data in memory as time goes on then this may not be a leak at all but it might indicate an architectural problem in that you're not flushing caches.

1.5GB however is not a lot of memory so just having your VM that size in and of itself is no reason for you having to restart it every day. It sounds like you have another problem and sticky references is the most likely culprit.

cletus