2 Replies Latest reply on Mar 15, 2012 12:56 PM by Peter Johnson

    JBoss 6, PermGen usage

    Oliver Rapka Newbie

      In my company we evaluate JBoss 6.1.0.Final.


      We have deployed two EARs that contain in each case one WAR. The first EAR is for a JSP-/Servlet-based application. The second EAR contains a WAR for web services (Axis).


      We got problems with the OutOfMemoryErrors (PermGen Space). Now we increased the MaxPermGenSpace to 512MB and made a new test. With JConsole we could see that the usage of the Perm Gen ist constantly at a value of 393.580 KB (393 MB).


      Both EARs have a size of 45MB and contain a lot of own libraries and 3rd part libraries.


      Now my questions:

      We don't have many experiences with JBoss 6, but are these normal values for the MaxPermSize?

      We use Spring, but we don't use JSF.


      Used Hardware:

      CPUs: 2 * Xeon E5520 QuadCore 2,26GHz

      OS: SLES-11 x86_64

      RAM: (GB) 56


      Are the parameters


      -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled


      useful? We thought that in that way some objects of classes, methods, and strings that are no longer needed are garbage collected from the PermGen. With JConsole we could see that sometimes the PermGen Space is a little bit decreased.



      The full parameter list for Xms, Xmx, MaxPermSize, and so on in run.conf is:


      JAVA_OPTS="-Xms1024m -Xmx1024m -XX:MaxPermSize=512m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=1800000 -Dsun.rmi.dgc.server.gcInterval=1800000 -Duser.language=de -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled"


      We also set


      -Dsun.rmi.dgc.client.gcInterval=1800000 -Dsun.rmi.dgc.server.gcInterval=1800000


      with the hope that the PermGen is more often garbage collected.

        • 1. Re: JBoss 6, PermGen usage
          Wolf-Dieter Fink Master

          JSP pages are compiled on-demand and that classes are loaded in the PermGen space. I don't know how Axis works but it might also use dynamic class compiling.

          So if you not very often change the pages the PermGen is more or less filled with the same classes and do not need a GC very often.

          1 of 1 people found this helpful
          • 2. Re: JBoss 6, PermGen usage
            Peter Johnson Master

            Of all of the setting you mentioned, only CMSClassUnloadingEnabled has anything to do with the permgen. And classes are unloaded from the permgen only if they are no longer needed. Usually, once a class is loaded it is always needed and is never freed.


            The "-Dsun.rmi.dgc.client.gcInterval=1800000 -Dsun.rmi.dgc.server.gcInterval=1800000" setting simply causes a full collection every 30 minutes, whether you need it or not. Usually, you will have run several full collections within 30 minutes anyway, so forcing another doesn't really make any sense. I recommend either setting these to very high values (such as a month or a year), or setting -XX:+DisableExplicitGC, which will turn force collects off entirely.


            The "normal" size for the permgen is how ever big you need ti to be. If you monitor the permgen size, as you did using JConsole, you will get an idea of how big it needs to be. Set it for that size plus a little extra (20-25% more). Based on the size you see (about 400MB), the maxpermsize you specified of 512MB seems acceptable.