β

JVM参数大全

佐井 164 阅读

说明:

JVM命令行参数分为三种类型:标准选项(Java Virtual Machine Specification里定义的参数),非标准选项(以-X为前缀,不强制JVM实现),非稳定选项(以-XX为前缀,可能在某些版本被移除)

CMS相关

选项 类型 默认值 备注
-XX:+UseConcMarkSweepGC boolean false 老年代采用CMS收集器收集
-XX:+CMSScavengeBeforeRemark boolean false The CMSScavengeBeforeRemark forces scavenge invocation from the CMS-remark phase (from within the VM thread as the CMS-remark operation is executed in the foreground collector).
-XX:+UseCMSCompactAtFullCollection boolean false 对老年代进行压缩,可以消除碎片,但是可能会带来性能消耗
-XX:CMSFullGCsBeforeCompaction=n uintx 0 CMS进行n次full gc后进行一次压缩。如果n=0,每次full gc后都会进行碎片压缩。如果n=0,每次full gc后都会进行碎片压缩
–XX:+CMSIncrementalMode boolean false 并发收集递增进行,周期性把cpu资源让给正在运行的应用
–XX:+CMSIncrementalPacing boolean false 根据应用程序的行为自动调整每次执行的垃圾回收任务的数量
–XX:ParallelGCThreads=n uintx 并发回收线程数量:(ncpus <= 8) ? ncpus : 3 + ((ncpus * 5) / 8)
-XX:CMSIncrementalDutyCycleMin=n uintx 0 每次增量回收垃圾的占总垃圾回收任务的最小比例
-XX:CMSIncrementalDutyCycle=n uintx 10 每次增量回收垃圾的占总垃圾回收任务的比例
-XX:CMSInitiatingOccupancyFractio=n uintx jdk5 默认是68% jdk6默认92% 当老年代内存使用达到n%,开始回收。`CMSInitiatingOccupancyFraction = (100 - MinHeapFreeRatio) + (CMSTriggerRatio * MinHeapFreeRatio / 100)`
-XX:CMSMaxAbortablePrecleanTime=n intx 5000 在CMS的preclean阶段开始前,等待minor gc的最大时间。[see here](https://blogs.oracle.com/jonthecollector/entry/did_you_know)
-XX:+UseBiasedLocking boolean true Enables a technique for improving the performance of uncontended synchronization. An object is "biased" toward the thread which first acquires its monitor via a `monitorenter` bytecode or synchronized method invocation; subsequent monitor-related operations performed by that thread are relatively much faster on multiprocessor machines. Some applications with significant amounts of uncontended synchronization may attain significant speedups with this flag enabled; some applications with certain patterns of locking may see slowdowns, though attempts have been made to minimize the negative impact.
-XX:+TieredCompilation boolean false Tiered compilation, introduced in Java SE 7, brings client startup speeds to the server VM. Normally, a server VM uses the interpreter to collect profiling information about methods that is fed into the compiler. In the tiered scheme, in addition to the interpreter, the client compiler is used to generate compiled versions of methods that collect profiling information about themselves. Since the compiled code is substantially faster than the interpreter, the program executes with greater performance during the profiling phase. In many cases, a startup that is even faster than with the client VM can be achieved because the final code produced by the server compiler may be already available during the early stages of application initialization. The tiered scheme can also achieve better peak performance than a regular server VM because the faster profiling phase allows a longer period of profiling, which may yield better optimization.

JVM参数大全 was originally published by 佐井 at 佐井 on October 14, 2013.

作者:佐井
原文地址:JVM参数大全, 感谢原作者分享。