Common JVM configuration parameters

 

1.Trace trace parameters

 1.1 -verbose:gc

  -XX:+printGC

  Can print brief information about GC

  [GC 4790K->374K(15872K), 0.0001606 secs]

  [GC 4790K->374K(15872K), 0.0001474 secs]

  [GC 4790K->374K(15872K), 0.0001563 secs]

  [GC 4790K->374K(15872K), 0.0001682 secs]

   1.2-XX:+PrintGCDetails

  print GC details

-XX:+PrintGCTimeStamps

Print the timestamp when the CG occurred

example

[GC[DefNew: 4416K->0K(4928K), 0.0001897 secs] 4790K->374K(15872K), 0.0002232 secs] [Times: user=0.00 sys=0.00, real=0.00 secs]

 1.3 -XX:+PrintGCDetails output

 1.4 -Xloggc:log/gc.log

Specify the location of the GC log to output as a file

Help developers analyze problems

 1.5 -XX:+PrintHeapAtGC

After each GC , print heap information

  1.6

-XX:+TraceClassLoading

Monitoring class loading

 

1.7 -XX:+PrintClassHistogram

After pressing Ctrl+Break , print the class information:

Display separately: serial number, number of instances, total size, type

 

2. Heap allocation parameters

  2.1-Xmx Xms

Specify max heap and min heap

 2.2 -XX:+HeapDumpOnOutOfMemoryError

Export heap to file when OOM

-XX:+HeapDumpPath

2.3  -XX:OnOutOfMemoryError

On OOM , execute a script

"-XX:OnOutOfMemoryError=D:/tools/jdk1.7_40/bin/printstack.bat %p

 When the program OOM , a dump of the thread will be generated in D:/a.txt

You can send emails and even restart programs when OOM

 

Path to export OOM

Summary: Resize Young and Survivor Generations Based on Reality

It is officially recommended that the new generation account for 3/8 of the heap

The surviving generation accounts for 1/10 of the young generation

During OOM , remember to dump the heap to ensure that you can troubleshoot on-site problems

 

3. Assignment parameters of the permanent area

 -XX:PermSize  -XX:MaxPermSize

Set the initial space and maximum space of the permanent area

How many types can a system hold, they said

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325383479&siteId=291194637