2 Replies Latest reply on Oct 23, 2010 7:22 AM by Wolf-Dieter Fink

    GC + JVM settings

    xiao fong Newbie



      Could some one please share with me how you would configure the following if your application server is JBoss?


      - update JVM to use 2GB heap size

      - configure JVM to start Garbage collector at around 1.5 GB.


      This is only one JBoss instance.


      Thank you.

        • 1. Re: Garbage collection + JVM settings
          Peter Johnson Master

          First, you need a 64-bit OS and a 64-bit JVM (well, if you are running 32-bit Linux you might be able to get a 2GB heap). Second, you an't tell the JVM to not do any garbage collections until it reached 1.5GB of usage. Finally, are you sure that you really need a 2GB heap?

          To get a better understanding of how GC works, see my whitepapers titled:

          • Java Garbage Collection Statistical Analysis 101
          • Java Garbage Collection Performance Analysis 201

          at http://www.cmg.org/cgi-bin/search.cgi?q=java+peter+johnson&x=30&y=10


          In the JBoss AS run config file, change the JAVA_OPTS line that sets the heap. Example:


          set "JAVA_OPTS=-Xms2048m -Xmx2024m -XX:MaxPermSize=256M"


          I would provide some more specific instructions but you never said:

          • what OS you are running on
          • which version of JBoss AS you are using
          • which version of the JVM you are running
          • 2. Re: Garbage collection + JVM settings
            Wolf-Dieter Fink Master

            As Peter said it is a bit rare information.


            But I support a application with about 400-500 transactions per second for one JBoss instance.

            It run with 1500m heap (Xms and Xmx with same value) and 128m permSize.

            The maximum of memory depends on the OS and JVM implementation, simple to test with the Xms option, the JVM did not start if the memory is not supported. (e.g. we use Solaris 64Bit with the original Sun 32Bit-JVM with 3600m for some cases)


            The GC behaviour is extreme application dependend! A good practice is to have objects with short livecycle, in this case the GC is able to run faster.


            In general you have to understand how the GC works. Good starting points are [1][2].

            Also you might test the JVM tools JStat and VisualGC from Sun (sorry Oracle ;-)


            search at oracle techwork for 'GC tuning' or the tools.



            [1] JVM5  http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html

            [2] JVM6 http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html