Java12 & 13 new features - Shenandoah GC

Shenandoah garbage collector is to achieve Red Hat announced in 2014, a garbage collector research project Pauseless GC, designed to recover for the needs of memory on JVM low pause. This design and application threads concurrently, by exchanging CPU concurrent cycles and space to improve the dwell time so that the garbage collector thread of execution can heap compression in Java threads run time, and mark and finishing can be performed simultaneously, thus avoiding large most JVM garbage collector problem encountered.

Shenandoah GC main goal is less than 99.9% of independent suspension 10ms, suspended heap size.

Payback period of garbage classification:
  • Divided by the number of threads, the garbage collector can be divided into serial and parallel garbage collector.
    • Serial recovery period refers to the same thing occurs only simple terms, when a plurality of CPU is available, only one CPU
      for executing the garbage collection operation, and when the garbage collection well, program worker threads will be suspended, the garbage collection when the work is completed
      before will resume the suspended worker thread, which is serial recovery.
    • Instead recycling and serial, parallel collection can be performed simultaneously using multiple CPU garbage collection, and thus enhance the throughput of applications, but a parallel back
      income remained the same serial recycling, the use of exclusive, use the "Stop-the-world" mechanisms and replication algorithm.
  • Points according to the operation mode can be divided into concurrent recovery and exclusive garbage collector.
    • Concurrent garbage collector thread alternately work with the application in order to reduce the dwell time of the application as possible.
    • Exclusive garbage collector (Stop the world) once running, stop all other threads in the application until the garbage collection process is completely
      full end.
  • Process can be divided into pieces by compression and non-compression garbage collector garbage collector.
    • Compression garbage collector after the recovery is completed, the live objects are compressed organize, remove debris after recovery.
    • Non-compression type of garbage collector does not perform this operation.
  • Press the memory range of work can be divided into the young generation garbage collector and old's garbage collector .
How to evaluate the performance of a GC
  • Throughput: running time of the program (running time of the program memory + recovery time).
  • Garbage collection overhead: throughput complement, the garbage collector proportion of time and total time.
  • Pause time: garbage collection, thread work program is suspended time.
  • Collection frequency: with respect to the execution of the application, the operating frequency of occurrence of collection.
  • Heap space: Java heap area occupied by memory size.
  • Quick: An object recovery time is experienced from birth to.
Shenandoah GC works:

Its memory structure is very similar to the G1, are similar to the memory is divided into a checkerboard of region. G1 and the overall process is relatively similar, the biggest difference is the realization of a concurrent evacuation (Evacuation) link, BrooksForwarding Pointer technology into the GC makes when you move an object, the object reference can still be accessed.

KnlJAS.png

Init Mark concurrent mark phase starts:

  1. Concurrent mark heap traversal stage
  2. Concurrent mark the completion stage
  3. Concurrent Resolution and Collection of inactivity regional stage
  4. Concurrent Evacuation area of ​​memory consolidation phase
  5. Init Update Refs update references initialization phase
  6. Concurrent update the reference phase
  7. Final Update Refs complete reference update phase
  8. No concurrent recovery phase reference area
Configure or debug JVM parameters of Shenandoah:
  1. -XX: + AlwaysPreTouch: use all available memory paging, reduce system operating pause, in order to avoid run-time performance penalty.
  2. -Xmx == -Xmsv: set the initial heap size is consistent with the maximum value, can reduce stress caused by stretching heap size, the parameters used in conjunction with AlwaysPreTouch submit all the memory at startup to avoid system downtime in the final use.
  3. -XX: + UseTransparentHugePages: can greatly improve the performance of piles, but recommended that when used on Linux
    / SYS / Kernel / mm / transparent_hugepage / Enabled and / sys / kernel / mm / transparent_hugepage / defragv to: madvise, and at the same time when used with AlwaysPreTouch, init and shutdownv faster, because it uses a larger page pretreatment.
  4. -XX: + UseNUMA: Shenandoah although not yet clear support for NUMA (Non-Uniform Memory Access) , but it is best to enable this function
    can to enable NUMA on a multi-slot mainframe staggered. Combined with AlwaysPreTouch, it provides better performance than the default configuration.
  5. -XX: + DisableExplicitGC: Ignore System.gc code () call. When the user invokes System.gc () in the code forces
    Shenandoah performed STW Full GC, it should be disabled to prevent execution of this operation, also can be used -
  6. XX: + ExplicitGCInvokesConcurrent, the implementation of CMS GC when calling System.gc () instead of Full GC, has recommended
    the use of case System.gc () call.
    But now Shenandoah garbage collector has also been labeled as experimental projects, --with-jvmfeatures with shenandoahgc option if you want to use needs to be compiled Shenandoah GC, using the parameters and then start
  7. -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC

Guess you like

Origin www.cnblogs.com/androidsuperman/p/11704968.html