部分JVM参数解释

 从大神手里拿过来的JVM调优参数,仅仅是把每个参数的含义查询了一下,越是查询越是感觉得到,小用户量的产品优化无从谈起,用户量起来了一切就要从细节入手慢慢优化。知识还需要继续深化,自己知道的往往是浮在表面的东西。


堆=年轻代(new)+年老代(old)

年轻代 = Eden 和 Survivor*2

-Xmx2048m 最大堆大小

 -Xms2048m 初始堆大小

 -Xmn1024m 年轻代大小

 -Xss1m 每个线程的堆栈大小

 -XX:PermSize=256m 初始持久代大小

 -XX:MaxPermSize=256m 最大持久代大小

 -XX:+UseParNewGC 设置年轻代为并行收集

 -XX:+UseConcMarkSweepGC 设置年老代为并发收集

 -XX:+CMSParallelRemarkEnabled 降低标记停顿

 -XX:SurvivorRatio=8 eden/survivor的比值

 -XX:MaxTenuringThreshold=15 这个参数用于控制对象能经历多少次Minor GC才晋升到旧生代

 -XX:CMSInitiatingOccupancyFraction=75 CMS堆上, 使用75%后开始CMS收集。

 -XX:+UseCMSInitiatingOccupancyOnly  仅仅使用手动定义初始化定义开始CMS收集

 -XX:+UseCompressedOops

 Most HotSpot JVM in the last year have had it on by default. This option allows references to be 32-bit in a 64-bit JVM and access close to 32 GB of heap. (more than 32-bit pointers can) (You can have near unlimited off heap memory as well). This can save a significant amount of memory and potentially improve performance.

If you want to use this option I suggest you update to a version which has it on by default as there may have been a good reason, such as bugs, why it wasn't enabled previously. Try Java 6 update 23 or Java 7 update 5.

In short, don't turn it on, use a version which has it on by default.


 -XX:+PrintGCDetails 打印较为详细的GC信息

 -XX:+PrintGCDateStamps 打印GC时间戳,相对于应用程序启动的时间

 -XX:+PrintClassHistogram 打印类的直方图 ,用kill -3 pid 会打印 

 -Xloggc:log/gc.log  打印GC信息到指定文件   可以设置绝对路径的。


你可能感兴趣的:(部分JVM参数解释)