JVM garbage collectors learning record 3--

Posted a map

  • Serial Collector

    The simplest collector, single-threaded, the collection will be suspended user thread, known as "stop the world".

  • ParNew collector

    Multi-threaded version of the Serial collector, other similar. The default number of threads is the number of CPU threads by -XX:? ParallelGCThreads = You can specify the number of threads

  • Parallel Scavenge collector

    Replication algorithm, multi-threaded collector. ParNew is distinguished in that the collector system throughput of interest (= user runs a certain time / (+ runtime user garbage collection time)). By -XX: MaxGCPauseMillis disposed garbage collection time, the garbage collector array is too short will result in an incomplete, so that the frequency becomes higher GC. Clearance -XX: GCTimeRatio than the set time and run-time garbage collection, the default value is 99, allowing a 1% (1 / (1 + 99)).

  • Serial Old collectors

    Serial version of the old generation collector, with only Mark - Collation Algorithm.

  • Parallel Old collectors

    Parallel Scavenge version of the old generation, the use of mark - sorting algorithms.

  • CMS(Concurrent Mark Sweep)

    CMS is a way to get the shortest time to pause collector goals. Using markers - sorting algorithm, but more complex than the above.

    • The initial mark (CMS initial mark)
    • Concurrent mark (CMS concurrent mark)
    • Relabeled (CMS remark)
    • Concurrent Clear (CMS concurrent sweep)

    CMS is an excellent garbage collector, concurrent collection, low standstill. However, there are three significant drawbacks:

    • CMS collector is very sensitive to CPU resources. In a concurrent stage, although not result in the user process stalled, but still uses a portion of CPU, resulting in low throughput. The number of recovery threads CMS is enabled by default (the number of CPU +3) / 4,
    • CMS can not clean up floating garbage, it simply is concurrent stages, new garbage generated by the user program can not be recovered. This is because of this, so during garbage removal, memory must also leave space for user threads, by default, CMS collector will use 68% of the space after the activation of the old generation. By -XX: CMSInitiatingOccupancyFraction to set this value. If CMS recovery period, the reserved space can not meet, it will lead to "concurrent mode failure", then start the virtual machine record: Serial temporary use to collect garbage, which will pause longer.
    • CMS is based on the mark - to clean up the algorithm, it can cause a lot of memory fragmentation.
  • G1 collector

    G1 collector is the most powerful garbage collector, is simply an upgraded version of Parallel Scavenge.

    G1 collector using mark - Collation Algorithm, no memory fragmentation. G1 and the collector can be precisely controlled pause, allow a user to set the time period M milliseconds, garbage collection time will be in the M milliseconds.

    G1 collector can be achieved without sacrificing the basic premise of the low throughput of garbage collection pause completed, because it is trying to avoid garbage collection across the region. G1 collector will stack (including the new generation, the old generation) into a plurality of blocks, and generates a priority list, block priority garbage up.

Guess you like

Origin www.cnblogs.com/duangL/p/11575074.html