Question

I'm using an ICEFaces application that runs over JBOSS, my currently heapsize is set to

-Xms1024m –Xmx1024m -XX:MaxPermSize=256m

what is your recommendation to adjust memory parameters for JBOSS AS 5 (5.0.1 GA) JVM 6?

Was it helpful?

Solution

According to this article:

AS 5 is known to be greedy when it comes to PermGen. When starting, it often throws OutOfMemoryException: PermGen Error.

This can be particularly annoying during development when you are hot deploying frequently an application. In this case, JBoss QA recommends to raise the permgen size, allow classes unloading and permgen sweep:

-XX:PermSize=512m -XX:MaxPermSize=1024 -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled

But this is more FYI, I'm not suggesting to apply this configuration blindly (as people wrote in comments, "if it ain't broken, don't fix it").

Regarding your heap size, always keep in mind: the bigger the heap, the longer the major GC. Now, when you say "it was definitely too small", I don't really know what this means (what errors, symptoms, etc). To my knowledge, a 1024m heap is actually pretty big for a webapp and should really be more than enough for most of them. Just beware of the major GC duration.

OTHER TIPS

Heap: Start with 512 MB, set the cap to where you believe your app should never get, and not to make your server start swapping.

Permgen: That's usually stable enough, once the app reads all classes used in the app. If you have tested the app and it works with 256 MB, then leave it so.

@wds: It's definitely not a good idea to set the heap maximum as high as possible for two reasons:

  1. Large heaps make full GC take longer. If you have PermGen scanning enabled, a large PermGen space will take longer to GC as well.
  2. JBoss AS on Linux can leave unused I/O handles open long enough to make Linux clean them up forcibly, blocking all processes on the machine until it is complete (might take over 1 minute!). If you forget to turn off the hot deploy scanner, this will happen much more frequently.

This would happen maybe once a week in my application until I:

  1. decreased -Xms to a point where JBoss AS startup was beginning to slow down
  2. decreased -Xmx to a point where full GCs happened more frequently, so the Linux I/O handle clean up stopped

For developers I think it's fine to increase PermGen, but in production you probably want to use only what is necessary to avoid long GC pauses.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top