Java G1 garbage collection in production

后端 未结 16 1728
借酒劲吻你
借酒劲吻你 2020-11-28 18:41

Since Java 7 is going to use the new G1 garbage collection by default is Java going to be able to handle an order of magnitude larger heap without supposed \"devastating\" G

相关标签:
16条回答
  • 2020-11-28 19:09

    G1 makes the application a lot more agile: the latancy of the application will raise - the app can be named as "soft-real-time". This is done by replacing two kinds of GC runs (small minor ones and one big on Tenured Gen) to equal-sized small ones.

    For more details look at this: http://geekroom.de/java/java-expertise-g1-fur-java-7/

    0 讨论(0)
  • 2020-11-28 19:11

    Recently I have been moved from

    CMS to G1GC with 4G heap & 8 core processor on servers with JDK 1.7.45.

    (JDK 1.8.x G1GC is preferred over 1.7 but due to some limitations, I have to stick to 1.7.45 version)

    I have configured below key parameters and kept all other parameters to default values.

    -XX:G1HeapRegionSize=n, XX:MaxGCPauseMillis=m, -XX:ParallelGCThreads=n, 
    -XX:ConcGCThreads=n apart from -Xms and -Xmx
    

    If you want to fine tune these parameters, have a look at this oracle article.

    Key observations:

    1. Memory usage is consistent with G1GC unlike high & lows with CMS
    2. Max GC pause time is less compared to CMS
    3. Time spent in Garbage collection is little bit high in G1GC compared to CMS.
    4. Number of major collections are almost negligible compared to CMS
    5. Number of minor collections are on higher end compared to CMS

    But still I am happy that Max GC pause time is less than as of CMS. I have set Max GC pause time as 1.5 seconds and this value has not been crossed yet.

    Related SE question:

    Java 7 (JDK 7) garbage collection and documentation on G1

    0 讨论(0)
  • 2020-11-28 19:11

    G1 GC is supposed to work better. But if setting -XX:MaxGCPauseMillis too aggressively, garbage will be collecting too slowly. And that's why full GC triggered in David Leppik's example.

    0 讨论(0)
  • 2020-11-28 19:13

    I have just implemented G1 Garbage Collector in our Terracotta Big Memory project. While working on different types of collectors G1 gave us the best results with less than 600ms respond time.

    You can find the test results (26 in total) here

    Hope it helps.

    0 讨论(0)
提交回复
热议问题