8.1 JVM parameters
8.1.1 standard parameters
-version
-help
-server
-cp
8.1.2 -X parameters
Non-standard parameters may vary with the JDK version
-Xint 解释执行
-Xcomp 第一次使用就编译成本地代码
-Xmixed 混合模式,JVM自己解决
8.1.3 -XX parameters used frequently
Non-standardized parameters, relatively unstable, mainly for JVM tuning amount Debug
a.Boolean类型
格式: -XX:[+-]<name> +或-表示启用或者禁用name属性
比如: -XX:+UseConcMarkSweepGC 表示启用CMS类型的垃圾回收器
-XX:+UseG1GC 表示启用G1类型的垃圾回收器
b.非Boolean类型
格式:-XX<name>=<value>表示name属性的值是value
比如:-XX:MaxGCPauseMillis=500
8.1.4 Other parameters
-Xms1000等价于-XX:InitialHeapSize=1000
-Xmx1000等价于-XX:MaxHeapSize=1000
-Xss100等价于-XX:ThreadStackSize=100
8.1.5 View Parameters
java -XX:+PrintFlagsFinal -version > flflags.txt
"=" Represents a default value ": =" represents a value of a user is modified or JVM
8.1.6 set the parameters of the way
-
IDEA by VMoption
-
Run jar package, java -XX: + UseG1GC xxx.jar
-
web container can be set in the script
-
(Marked manageable parameters of flags can be modified) by dynamically adjusting the parameters jinfo a java process
8.1.7 Unit Conversion
1Byte(字节)=8bit(位)
1KB=1024Byte(字节)
1MB=1024KB
1GB=1024MB
1TB=1024GB
(1)设置堆内存大小和参数打印
-Xmx100M -Xms100M -XX:+PrintFlagsFinal
(2)查询+PrintFlagsFinal的值
:=true
(3)查询堆内存大小MaxHeapSize
:= 104857600
(4)换算104857600(Byte)/1024=102400(KB)
102400(KB)/1024=100(MB)
(5)结论
104857600是字节单位
8.1.8 Common Parameter Meaning
parameter | meaning | Explanation |
---|---|---|
-XX:CICompilerCount=3 | The maximum number of parallel compilation | If the set is greater than 1, to improve the compilation speed, stability decreases |
-XX:InitialHeapSize=100M | Initialization heap size | Shorthand -Xms100M |
-XX:MaxHeapSize=100M | The maximum heap size | Shorthand -Xmx100M |
-XX:NewSize=20M | Set the size of the new generation | |
-XX:MaxNewSize=40M | The maximum size of the new generation | |
-XX:OldSize=50M | Set old's size | |
-XX:MetaspaceSize=50M | Area size setting method | |
-XX:MaxMetaspaceSize=50M | The maximum size of the method area | |
-XX:+UseParallelGC | Use ParallelGC | The new generation, the throughput priority |
-XX:+UseParallelOldGC | Use ParallelOldGC | Years old, throughput priority |
-XX:+UseConcMarkSweepGC | Use CMS | Years old, dwell time priority |
-XX:+UseG1GC | Use G1 | Old and new era, pause time priority |
-XX:NewRatio | The ratio of old and new | Example: -XX: NewRatio = 4, then the new: Old = 1: 4, the new generation of memory occupied by heap 1/5 |
-XX:SurvivorRatio | Eden ratio of the two area S and | Example: -XX: SurvivorRatio = 8, that is, (S0 + S1): Eden = 2: 8, |
-XX:+HeapDumpOnOutOffMemoryError | Start heap overflow Print | When the heap memory overflow occurs (OOM), the dump file generated automatically |
-XX:HeapDumpPath=heap.hprof | Specified directory heap overflow printing | Represents a heap.hprof generate files in the current directory |
-XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps –Xloggc:log/gc.log | Print GC logs | You can use different garbage collectors, view comparison of the GC |
-Xss128k | Set the stack size for each thread | Experience is the best 3000-5000 |
-XX:MaxTenuringThreshold=6 | Enhance the maximum threshold of old age | The default value is 15 |
-XX:InitiatingHeapOccupancyPercent | Heap memory usage accounting concurrent GC cycle start | Used G1 garbage collection like it to trigger concurrent GC cycle, based on the entire heap usage, 0 stands for "GC cycle has been implementing the" default value is 45 |
-XX:G1HeapWastePercent | Allow the waste heap space accounting | The default value is 10%, if concurrent mark recoverable space is less than 10% does not trigger MixedGC |
-XX:MaxGCPauseMillis=200ms | G1 maximum pause time | Dwell time is not too small, too small will lead to G1 keep up with the speed of garbage generated, triggers Full GC. |
-XX:ConcGCThreads=n | Use of concurrent garbage collector thread count | The default value is set according to the JVM runtime platform |
-XX:G1MixedGCLiveThresholdPercent=65 | Mixing garbage collection cycle set to include the area occupied by the old threshold | The default occupancy rate of 65% |
-XX:G1MixedGCCountTarget=8 | After the cycle is completed flag is set, the upper limit of the data on survival of old G1MixedGCLiveThresholdPercent execution target frequency region of mixed waste collected | Default eight mixed garbage collection, mixed garbage collection is aimed primarily controlled within this target letter |
-XX:G1OldCSetRegionThresholdPercent=1 | 描述Mixed GC时,Old Region 被加入到CSet中 | 默认情况下,G1只把10%的Old Region加入到CSet中 |
When I let go of what I am , I become what I might be.
走出舒适圈,遇见更好的自己。
目录 8.1 JVM参数 8.1.1 标准参数 8.1.2 -X参数 8.1.3 -XX参数 使用频繁 8.1.4 其他参数 8.1.5 查看参数 8.1.6 设置参数的方式 8.1.7 单位换算 8.1.8 常用参数含义
[Mùlù 8.1 JVM cānshù 8.1.1 Biāozhǔn cānshù 8.1.2 -X cānshù 8.1.3 -XX cānshù shǐyòng pínfán 8.1.4 Qítā cānshù 8.1.5 Chákàn cānshù 8.1.6 Shèzhì cān shǔ de fāngshì 8.1.7 Dānwèi huànsuàn 8.1.8 Chángyòng cānshù hányì]
table of Contents
8.1 JVM parameters
8.1.1 standard parameters
8.1.2 -X parameters
8.1.3 -XX parameters used frequently
8.1.4 Other parameters
8.1.5 View Parameters
8.1.6 set the parameters of the way
8.1.7 Unit Conversion
8.1.8 Common Parameter Meaning
8.1 JVM parameters
8.1.1 standard parameters
8.1.2 -X parameters
8.1.3 -XX parameters used frequently
8.1.4 Other parameters
8.1.5 View Parameters
8.1.6 set the parameters of the way
8.1.7 Unit Conversion
8.1.8 Common Parameter Meaning