1 Reply Latest reply on May 4, 2016 2:16 PM by nadirx

    Optimal Garbage Collector settings for large heaps?

    vdzhuvinov

      Are there any recommended settings for the JVM to reduce the likelyhood and the effect of stop-the-world GC events? Pauses in the order of several minutes and more have been observed on a 15GB heap.

        • 1. Re: Optimal Garbage Collector settings for large heaps?
          nadirx

          Ah, JVM tuning is one of those arcane subjects

          At any rate a 15GB heap should not give you such long pauses if the JVM is tuned properly.

          Here are some tips:

          CMS Tuning

          • Always turn off adaptive sizing (-Xms=-Xmx)
          • Manually tune for smaller young generation
          • -XX:NewSize=-XX:MaxNewSize - start 1/8 heap (2GB max)
          • CMS balancing act
          • Smaller new size => decrease throughput
          • Larger new size => Risk of stop-the-world
          • Increase the Eden size -XX:SurvivorRatio=16 (or 32)
          • Concurrent Mode Failure (gc logs)
            • Increase the heap size
            • Increase the old generation
            • Start CMS earlier: -XX:CMSInitiatingOccupancyFraction=60 -XX:+UseCMSInitiatingOccupancyOnly
          • Insufficient heap size (> 50% live data)
            • Sawtooth pattern (VisualVM)
            • Increase the NewSize

          G1 Tuning

          • Always turn off adaptive sizing (-Xms=Xmx)
          • Tune the pause time (–XX:MaxGCPauseMillis) to meet the 90th percentile for your SLA
          • Starting points: 500ms for 32GB, 1000ms for 64GB
          • Larger values increase the throughput
          • Stop-the-world Pauses “Full GCs”, “to-space overflow/exhausted”
          • Increase –XX:MaxGCPauseMillis
            • Increase the heap size
            • Modify -XX:InitiatingHeapOccupancyPercent (default 45)
              • But not lower than the % of live data!
            • Increase -XX:ConcGCThreads

          OS Tuning

          • Use Huge Pages
            • Enable on the JVM level -XX:+UseLargePages
            • Enable at the OS level
            • Verify “java -Xmx<JDG max heap size>g -XX:+UseLargePages -version”
            • Disable Transparent Huge Pages