UseConcMarkSweepGC vs UseParallelGC

前端 未结 4 1395
忘了有多久
忘了有多久 2021-01-31 04:13

I\'m currently having problems with very long garbage collection times. please see the followig. My current setup is that I\'m using a -Xms1g and -Xmx3g. my application is using

相关标签:
4条回答
  • 2021-01-31 04:17

    If you have high survival rate, your heap may be too large. The larger the heap, the longer the JVM can go without GC'ing, so once it hits, it has so much more to move around.

    0 讨论(0)
  • 2021-01-31 04:22

    Step 1:

    1. Make sure that you have set enough memory for your application.
    2. Make sure that you don't have memory leaks in your application. Eclipse Memory Analyzer Tool or visualvm will help you to identify leaks in your application.

    Step 2:

    If you don't have any issues with Step 1 with respect to memory leaks, refer to oracle documentation page on use cases for specific garbage collection algorithm in "Java Garbage Collectors" section and gctuning article.

    Since you have decided to configure larger heaps (>= 8 GB), G1GC should work fine for you. Refer to this related SE question on fine tuning key parameters:

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

    0 讨论(0)
  • 2021-01-31 04:29

    Your heap is too small. The pause is so large because it's busy repeatedly scanning the entire heap desperately looking for anything to collect.

    You need to do 1 or possibly more of the following;

    • find and fix a memory leak
    • tune the application to use less memory
    • configure the JVM is use a bigger heap

    Are you tied to 1.4.2 for some reason? GC implementations really have moved on since then so you should consider upgrading if possible. I realise this may be a non trivial undertaking but it's worth considering anyway.

    0 讨论(0)
  • 2021-01-31 04:32

    Since you have extremenly long GC pauses, it's don't think that changing GC algorithm would help.

    Note that it's highly suspicious that you have only full collections. Perhaps you need to increase the size of young generation and/or survivor space.

    See also:

    • Tuning Garbage Collection with the 1.4.2 Java[tm] Virtual Machine
    0 讨论(0)
提交回复
热议问题