Option | Details |
---|---|
-XX:+UseConcMarkSweepGC | Sets the garbage collector policy to the concurrent (low pause time) garbage collector (also known as CMS)设置垃圾收集器并发政策(低暂态时间),垃圾收集器(也被称为CMS) |
-XX:+CMSIncrementalMode | Enables the incremental mode. (works only with -XX:+UseConcMarkSweepGC)启动增量模式(只作用于 -XX:+UseConcMarkSweepGC) |
-XX:+CMSIncrementalPacing | Enables automatic adjustment of the incremental mode duty cycle based on statistics collected while the JVM is running 当JVM在运行时,依据收集的统计信息启用增量模式自动调节占空比 |
-XX:CMSIncrementalDutyCycleMin | The percentage (0-100) which is the lower bound on the duty cycle when CMSIncrementalPacing is enabled 启动CMSIncrementalPacing占空比的最小值 |
-XX:CMSIncrementalDutyCycle | The percentage (0-100) of time between minor collections that the concurrent collector is allowed to run. If CMSIncrementalPacing is enabled, then this is just the initial value. |
-XX:ParallelGCThreads | Sets the number of garbage collector threads设置垃圾收集器的线程数 |
-XX:+UseParNewGC | Enables multi threaded young generation collection.启动多线程收集器 |
-XX:MaxGCPauseMillis | A hint to the throughput collector that it’s desirable that the maximum pause time is lowed than the given value. (n.b. it looks like this value can also be used with the CMS garbage collector) |
-XX:GCTimeRatio | A hint to the virtual machine that it’s desirable that not more than 1 / (1 + GCTimeRation) of the application execution time be spent in the collector |
-XX:+DisableExplicitGC | Disables explicit garbage collection calls (
|
标准的JVM是配置为了高吞吐量,吞吐量是为了科学计算和后台运行使用,而互联网商业应用,更多是为追求更短的响应时间,更低的延迟Latency(说白了就是更快速度),文章延迟到处存在,它会降低你的销售,用户打开网页没有快速响应,调马走人,亚马逊发现每100毫秒的延迟会损失1%的销售量。
而垃圾回收机制一旦启动就引发系统暂停,导致用户请求后的响应时间延长,通常的JVM配置参数如下:
|
作者发现使用-XX:+UseConcMarkSweepGC有性能上百分之40的降低,而网络上各种JVM调试都推荐此配置。
使用下面配置,比UseConcMarkSweepGC 有百分之20的性能提升,且暂停时间在100微秒以下(10K 100线程)
|
垃圾回收机制
Advanced JVM Tuning for Low Pause | mindstorms
辅助作者观点的另外一篇实战案例JVM配置也是如上,该案例中几乎使用了Oracle的内存数据库,但是还是有问题,使用类似上述配置后得到性能提升:
http://www.tikalk.com/java/performance-tunning-case-study
|