紧接前2篇文章,我们今天来聊聊升级 Java11 之后的一写 Jvm 参数变化。Java11 删除掉了 cms 垃圾回收器,如果你升级到了 Java11 但是 Jvm 参数仍然使用 cms 垃圾回收器参数时控制台会报错,甚至会启动失败。
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release. Unrecognized VM option 'ParallelCMSThreads=2' Did you mean 'ParallelGCThreads=<value>'? Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. 复制代码
Option and Default Value | Description |
---|---|
-XX:+UseG1GC | Use the Garbage First (G1) Collector |
-XX:MaxGCPauseMillis=n | Sets a target for the maximum GC pause time. This is a soft goal, and the JVM will make its best effort to achieve it. |
-XX:InitiatingHeapOccupancyPercent=n | Percentage of the (entire) heap occupancy to start a concurrent GC cycle. It is used by GCs that trigger a concurrent GC cycle based on the occupancy of the entire heap, not just one of the generations (e.g., G1). A value of 0 denotes 'do constant GC cycles'. The default value is 45. |
-XX:NewRatio=n | Ratio of old/new generation sizes. The default value is 2. |
-XX:SurvivorRatio=n | Ratio of eden/survivor space size. The default value is 8. |
-XX:MaxTenuringThreshold=n | Maximum value for tenuring threshold. The default value is 15. |
-XX:ParallelGCThreads=n | Sets the number of threads used during parallel phases of the garbage collectors. The default value varies with the platform on which the JVM is running. |
-XX:ConcGCThreads=n | Number of threads concurrent garbage collectors will use. The default value varies with the platform on which the JVM is running. |
-XX:G1ReservePercent=n | Sets the amount of heap that is reserved as a false ceiling to reduce the possibility of promotion failure. The default value is 10. |
-XX:G1HeapRegionSize=n | With G1 the Java heap is subdivided into uniformly sized regions. This sets the size of the individual sub-divisions. The default value of this parameter is determined ergonomically based upon heap size. The minimum value is 1Mb and the maximum value is 32Mb. |
G1GC | -Xlog:gc |
Log messages with gc tag using info level to stdout, with default decorations. |
---|---|---|
G1GC | -Xlog:gc,safepoint |
Log messages with either gc or safepoint tags (exclusive), both using 'info' level, to stdout, with default decorations. |
G1GC | -Xlog:gc+ref=debug |
Log messages with both gc and ref tags, using debug level, to stdout, with default decorations. |
G1GC | -Xlog:gc=debug:file=gc.txt:none |
Log messages with gc tag using debug lev
这篇关于「是时候升级java11了」虚拟机Jvm参数设置的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
您可能喜欢
栏目导航
|