This article transferred from: http://my.oschina.net/xishuixixia/blog/132395
Tuning parameters that are commonly used.
1. Heap Size
-XMS and-xmx are used to specify the heap size, and we need to set them to the same value to avoid resizing the heap after the GC.
2. Young Generation Size
-xx:newsize= and –xx:maxnewsize=? The young generation size is recommended to be set to a heap size of 1/3 or 1/4, and two values are the same size. Setting the size of the younger generation is quite important, and if the younger generation is set to small, then some objects that can have short life cycles may be moved to older generations, leading to full GC, and setting too large will also cause stop the world.
3. Method Area Size
-xx:permsize=256m and-xx:maxpermsize=256m, the method area size does not affect performance, as long as you set the value to ensure that the application does not report an error such as Oom.
4.GC Log
-XLOGGC: $CATALINA _base/logs/gc.log,-xx:+printgcdetails,-xx:+printgcdatestamps, record as many GC logs as possible, so that you can analyze the system behavior in a comprehensive way.
5.GC algorithm
-XX:+USEPARNEWGC,-xx:+cmsparallelremarkenabled,-XX:+USECONCMARKSWEEPGC,-xx:cmsinitiatingoccupancyfraction= 75, this is just the usual parameters in the general system, you also need to choose the most suitable system according to your system situation.
6. Heap Snapshots
-xx:+heapdumponoutofmemoryerror and-xx:heapdumppath= $CATALINA _base/logs.
7.OOM operations after the occurrence
After oom shutdown server:-xx:onoutofmemoryerror= $CATALINA _home/bin/stop.sh
Restart server after Oom:-xx:onoutofmemoryerror= $CATALINA _home/bin/restart.sh
JVM Tuning Summary (GO)