General J2EE: Running on JBoss: JVM grows and grows...
- Posted by: Gerard Maas
- Posted on: July 29 2004 10:39 EDT
I'm load-testing my application running on Jboss 3.2.2 and JVM 1.4.2_05-b04 -Xms 300M -Xmx 300M.
When running under load I see that the VM keeps on growing with each request. Using a profiler I see that the heap is stable, but then I can't explain the reason for the VM growing size.
Any idea of where should I start looking? I'm going into production next week and they consider this a mem leak. All profiling information indicates that neither Jboss or my business logic are wrongfully retaining objects.
Since there is the possibility for a memory leak here, I might try this:
1) With your app server running under JProbe or OptimizeIt
a) Run your use-case once
b) Mark the heap
c) Run your use-case a second time
d) Wait for GC, or initiate GC with the tool
e) Look for objects whose instance counts is > than the baseline when you marked the heap
f) Backtrace these objects to see if you can identify the source of the leak
From your post, you've done this. But it never hurts to try again or verify your methodology. If no leaks...
2) Investigate JVM configuration options that relate to GC configuration
b) Try tuning the JVM's with respect to GC ...how...I wish I knew to tell you.
I'm a little puzzled that the min and max size are the same 300M...I would think that the JVM would start at 300M...and not grow past 300M. So that it grows at all...I'm not sure I understand. You might try running with
-verbosegc to gain a more detailed understanding of how GC is being done in this application under load. Maybe under load GC is not being performed?
If you solve this, let me know, I'm curious...
I observed the same thing with other applications I developed. It seams the JVM extends the heap when it needs more space rather than performing garbage collection. I found documentation that states the contrary, though, that the JVM performs gc first. I appreciate any comments on this.
What I do is set the maximum heap size as low as possible and send hundreds of thounsands of requests to the server. If the server doesn't run out of mem it means there are no mem leaks. Profiling the heap is a very good idea as there may be tiny leaks that will produce problems only after millions request are processed.
Almost all of the time my problems are related to session cleanup. Make sure that all objects allocated for a session are dereferenced when the session is terminated.
Did you resolve this issue?
We are having the identical problem but the main difference been we are running Tomcat and Windows 2003
Thanks for any help