Skip to content

Instantly share code, notes, and snippets.

@fantasticmao
Last active November 29, 2018 16:35
Show Gist options
  • Save fantasticmao/984f3016f0fc237731b13aa687b30e8e to your computer and use it in GitHub Desktop.
Save fantasticmao/984f3016f0fc237731b13aa687b30e8e to your computer and use it in GitHub Desktop.
Factors Affecting Garbage Collection Performance

https://docs.oracle.com/javase/10/gctuning/factors-affecting-garbage-collection-performance.htm

  • -Xms<minimum>: min heap size
  • -Xmx<max>: max heap size
  • -XX:MinHeapFreeRatio=<min>: min (free space)/(live objects)
  • -XX:MaxHeapFreeRatio=<max>: max (free space)/(live objects)
  • -XX:NewRatio=<number>: (young generation)/(old generation)
  • -XX:NewSize=<min>: min young generation size
  • -XX:MaxNewSize=<max>: max young generation size
  • -XX:SurvivorRatio=<number>: (eden space)/(survivor space)

https://docs.oracle.com/javase/10/gctuning/parallel-collector1.htm

  • -XX:+UseParallelGC: use Parallel Collector
  • -XX:ParallelGCThreads=<N>: number of garbage collector threads
  • -XX:MaxGCPauseMillis=<N>: max GC pause time (milliseconds)
  • -XX:GCTimeRatio=<N>: (garbage collection time)/(application time)=1/(1+N)
  • -XX:YoungGenerationSizeIncrement=<Y>: percentage for the young generation growing
  • -XX:TenuredGenerationSizeIncrement=<T>: percentage for the old generation growing
  • -XX:AdaptiveSizeDecrementScaleFactor=<D>: percentage for generation shrinks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment