memory tuning
**
It is very important to set the heap size. Usually, as long as this setting is enough, there will be no overflow.
-Xms4096m
-Xmx4096m
Or- Xms 4g - Xmx 4g
should be the same size for the two values, so what is the maximum memory that 64-bit can generally support in order to reduce initialization time when converting
? If the physical memory is 32G (usually 90% of the physical memory, that is, 27\~28G)
, the size of
the new generation and the old generation is equivalent to setting the minimum and maximum new generation of the same value, and NewRatio sets the ratio of the new and old generation , NewRatio=1 means, two equal sizes
- Xmn 1g
If this value is not set, the default is only 6M
**Set persistent generation size
Similarly, these two values should be the same (jdk7)-XX:PermSize=512m
-XX:MaxPermSize=512m
JDK8 uses these two parameters-XX:MetaspaceSize=512m
-XX:MaxMetaspaceSize=512m
**Set code cache
-XX:ReservedCodeCacheSize=1024m
-XX:+UseCompressedOops
GC tuning
For concurrent GC threads, it is enough to set
the total number of threads of the server/the number of JVM instances, if there are 4 JVMs on a server. For example, 2 6-core hyperthreads (1 core is equivalent to 2 threads after hyperthreading) is 24/4=6 tuning, and the ParallelGCThreads
maximum setting should not exceed 6.
Mac notebook 4 cores and 8 threads, one jvm, ParallelGCThreads=CPU quantity/JVM quantity
-XX:ParallelGCThreads =8
CMS basic configuration
If cms is configured, -XX:+UseParNewGC
this parameter does not need to be set, because it is automatically opened when cms is set.
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
Log basic configuration
-Xloggc :/var/log/gc-sms.log
-XX:+PrintGCDateStamps
-XX:+PrintGCDetails
example
An example linkedin is as follows
// JVM sizing options
-Xms40g -Xmx40g -XX:MaxDirectMemorySize=4096m -XX:PermSize=256m -XX:MaxPermSize=256m
// Young generation options
-XX:NewSize=6g -XX:MaxNewSize=6g -XX:+UseParNewGC -XX:MaxTenuringThreshold=2 -XX:SurvivorRatio=8 -XX:+UnlockDiagnosticVMOptions -XX:ParGCCardsPerStrideChunk=32768// Old generation options
-XX:+UseConcMarkSweepGC -XX:CMSParallelRemarkEnabled -XX:+ParallelRefProcEnabled -XX:+CMSClassUnloadingEnabled -XX:CMSInitiatingOccupancyFraction=80 -XX:+UseCMSInitiatingOccupancyOnly// Other options
-XX:+AlwaysPreTouch -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:-OmitStackTraceInFastThrow
Reference: [ http://www.importnew.com/11336.html]
我的常用配置
-Xms14g
-Xmx14g
-Xmn5g
-XX:MetaspaceSize=512m
-XX:MaxMetaspaceSize=512m
-XX:ReservedCodeCacheSize=1024m
-XX:+UseCompressedOops
-XX:+UseConcMarkSweepGC
-XX:ParallelGCThreads=8
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly
-Xloggc:/var/log/gc-sms.log
-XX:+PrintGCDateStamps
-XX:+PrintGCDetails