5 Replies Latest reply on Jul 11, 2012 1:30 AM by 944574

    ParallelGCThreads in JAVA 6

      Can the value of ParallelGCThreads exceed the number of processors?
      In other words if the server has 4 processors, can the value of -XX:ParallelGCThreads= be set to 8?
      In all the docs that I have read I can assume that this is not possible, because the gc threads are tight up to the processors, but if I pass -XX:ParallelGCThreads=8 on a 4 cpu machinge I do see 8 runable GC threads being created.

      "GC task thread#0 (ParallelGC)" prio=10 tid=0x0000000048ce6800 nid=0x628f runnable
      "GC task thread#1 (ParallelGC)" prio=10 tid=0x0000000048ce8000 nid=0x6290 runnable
      "GC task thread#2 (ParallelGC)" prio=10 tid=0x0000000048cea000 nid=0x6291 runnable
      "GC task thread#3 (ParallelGC)" prio=10 tid=0x0000000048cec000 nid=0x6292 runnable
      "GC task thread#4 (ParallelGC)" prio=10 tid=0x0000000048ced800 nid=0x6293 runnable
      "GC task thread#5 (ParallelGC)" prio=10 tid=0x0000000048cef800 nid=0x6294 runnable
      "GC task thread#6 (ParallelGC)" prio=10 tid=0x0000000048cf1800 nid=0x6295 runnable
      "GC task thread#7 (ParallelGC)" prio=10 tid=0x0000000048cf3000 nid=0x6296 runnable

      I am a bit confused.

        • 1. Re: ParallelGCThreads in JAVA 6
          There is of course a difference between something being possible and something being a good idea ;)

          I don't see any documentation saying there is a limit; just that the default value chosen is equal to the number of CPUs / cores. Plus you've basically proven for yourself that it is possible here.
          • 2. Re: ParallelGCThreads in JAVA 6
            Is it a good idea? - that is my final question too.
            Still not clear if all the GC threads created by the switch will be used efficiently and safely by GC or there is a cap set by the number of processors.

            No one is talking about this subject and makes me wonder why.
            • 3. Re: ParallelGCThreads in JAVA 6
              941571 wrote:
              Is it a good idea? - that is my final question too.
              I'm not expert but common sense says no, it is not. A common strategy I see on the net is to pick a number of threads equal to the number of CPUs/cores that you have, divided by the number of JVMs you run on the machine. So if you have 4 cores and you're running 2 JVMs, configure 2 parallel threads in each.
              • 4. Re: ParallelGCThreads in JAVA 6
                I would refrain from doing this as you can introduce CPU starvation with multiple JVMs contending for a single CPU Thread.
                • 5. Re: ParallelGCThreads in JAVA 6
                  OK, since I started this thread I took some time and ran a set of tests on a RHL server, reduced the number of processors to 2, and run the same 2 hours load tests with 2, 4 and 8 ParralellGC threads. I kept max heap to 3gb and enabled UseOldParallelGC.
                  On average, Full GC pause times were identical on all these tests.
                  Latter tests with 4procs/4threads and 8procs/8threads showed a significant Full GC pause reductions.
                  These results suggests that the JVM/OS is most likely using some sort of locking mechanism that won't allow more then one thread per process to run GC cycles on a given time.

                  Yet, this way of running GC threads is not efficiently using multiple core CPU power, and hope to see it changed at some point.