File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes OutOfMemoryError when heap size was set to 1G Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "OutOfMemoryError when heap size was set to 1G" Watch "OutOfMemoryError when heap size was set to 1G" New topic
Author

OutOfMemoryError when heap size was set to 1G

vu lee
Ranch Hand

Joined: Apr 19, 2005
Posts: 189
Running on a linux box with 8 processors and 8G of RAM, my app server uses only stateless session bean. Originally, the max number of SLSB was 30 and the heap size was 0.5 G. To handle additional requests, I set the max to 200 and increased the heap size to 1G. The app server was shutdown due to OutOfMemoryError. On two consecutive days, I noticed that the server was down about two hours after the peak time because JVM could not allocate memory to create native thread. After I reset heap size back to 0.5G (kept the max number of SLSB to 200), my app server ran fine.
My question is that why my app server was not shutdown when the heap size was small? Was that because the default GC ran better with a small heap size?
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
Hi Vu

I don't think you would get specific answer here but to give my 2 cents, may be due to more memory + the nature of the peak time traffic the heap got more fragmented which made it run out of memory.

Here the issue is, the same peak traffic can't be reproduced. So we can't reproduce the same memory requirements with changing the max heap size next time. Though if we can consistently prove that with the higher heap settings it "always" runs out of memory after peak hours and when its set to low max heap size it works okay THEN we can try investigate it more and see why this behavior.

One time behavior doesn't provide us with good use case to analyse.

Thanks
Maulin
Amit A. Patil
Ranch Hand

Joined: May 04, 2006
Posts: 38
Why can the pick time load be simulated. Its worth investing in developing in load script. And be part of automated tests running ore every release.
Sam Semwal
Greenhorn

Joined: May 15, 2007
Posts: 19
You can use JMeter to stress test your application.
Also, please check that you are releasing the resources and not creating db and other connections every time unnecessary.
If it is a traffic problem use queuing mechanism.


TOGAF, SCJP 5.0, MBCS
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: OutOfMemoryError when heap size was set to 1G
 
Similar Threads
Interesting article about JVM performance
JBoss Unexpected Shutdown
improving tomcat performance
JBoss 4.0.4 is slow down in every 20 days
Analyse large heap dump file