Common Virtual Machine JVM Command Summary


title: JVM virtual machine commonly used commands are summarized
Comments: false
DATE: 2019-07-22 11:45:33
the Description: summarize common virtual machine JVM startup command.
categories: GC


Outline

This paper illustrates some JVM startup command role and methods of use.

When a Java program starts, we can make a virtual machine to print some parameters by adding a virtual machine parameters.

  • -XX:+PrintFlagsInitial: Printing virtual machine initialization parameters (that is, the default value of XXX)
  • -XX:+PrintFlagsFinal: Values ​​of the parameters of the virtual machine to print the entry into force of the final
  • -XX:+PrintCommandLineFlags: Print Command line parameters added

If you are interested in a parameter, then this parameter directly to Baidu, most of them speak good.

Related garbage collector

The following parameters are in server mode tests.

  • Use ParNew + CMS collector:-XX:+UseParNewGC -XX:+UseMarkSweepGC
  • Use Serial + Serial Old Collector:-XX:+UseSerialGC
  • Use Parallel Scavenge + Parallel Old Collector:-XX:+UseParallelGC -XX:+UseParallelOldGC
  • Use Serial + CMS collector: ERROR! ! !
  • Use G1 Collector:-XX:+UseG1GC

General parameters

  • -XX:PretenureSizeThreshold=0: If the size of the object is greater than this value, it will be allocated directly in the old era. If it is 0, then, that all objects are de-allocated in Eden.

ParNew collector related

  • -XX:ParallelGCThreads: Limit the number of threads for garbage collection.

Parallel Scavenge collector related

  • -XX:MaxGCPauseMillis: Maximum control garbage collection pause times.
  • -XX:GCTimeRatio: Throughput size directly.

CMS collector related

  • -XX:+UseCMSCompactAtFullCollection: When you use the concurrent collector, turn on compression for old age, the default is true.
  • -XX:CMSFullGCsBeforeCompaction=0: After open the case under the old's compressed, how many times Full GC settings to compress years old.
  • -XX:CMSInitiatingOccupancyFraction=90: Used to set the trigger percentage CMS garbage collector, too easily lead to "Concurrent Mode Failure" abnormal, too low, there will be frequent GC old's appearance.

Memory-related parameters

  • -Xms1g: Initial memory settings of the virtual machine, the default is the physical memory of 1/64.
  • -Xmx1g: Set the virtual machine's maximum memory available, the default is 1/4 of physical memory.
  • -Xmn512m: Sets the size of the new generation.
  • -XX:MetaspaceSize=128m: The default is 21m, adjust MetaSpace size.
  • -Xss1m: Setting the minimum limit of each thread stack size is 160K virtual machine, if less than this value, an error is reported: The stack size specified is too small, Specify at least 160k.
  • -XX:NewRatio=2: Set the ratio of the new generation and the old age, the default is 2, that is, if the heap is 300 MB, then the young generation accounted for 100 trillion.
  • -XX:SurvivorRatio=8: Setting the ratio of the new generation area and Survivor Eden region, the default is 8, i.e., 8 parts of Eden accounting, accounting for 1 parts by Sl, S2 occupy a part. If when the new generation of 10 trillion, the Eden area accounted for 8 trillion, and the remaining two each accounted for 1 trillion.
  • -XX:MetaspaceSize=100m Set the yuan space, the default is about 21 trillion,
  • -XX:+UseAdpptiveSizePoliy: The parallel collector automatically selected, and the ratio of the size of the young generation Survivor areas and old age, my environment default is false.

GC logs related

  • -XX:+PrintGC: Print simple GC logs.
  • -XX:+PrintGCDetails: Print verbose GC logs.
  • -XX:+PrintGCTimeStamps : Printing virtual machine since the start of the elapsed time.
  • -XX:+PrintGCApplicationConcurrentTime : Before each print garbage collection, the program does not interrupt the execution time.
  • -XX:+PrintGCApplicationStoppedTime: Print garbage recycling program is suspended during the time.
  • -XX:+PrintHeapAtGC: Print out a stack details when GC occurs.

Guess you like

Origin www.cnblogs.com/wuqinglong/p/11237213.html