JVM调优文献参考
(1) https://www.oracle.com/technetwork/java/javase/tech/exactoptions-jsp-141536.html
(2) https://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
The options are loosely grouped into three categories.
Behavioral options change the basic behavior of the VM.
Performance tuning options are knobs which can be used to tune VM performance.
Debugging options generally enable tracing, printing, or output of VM information.
(3) https://www.oracle.com/technetwork/java/javase/trouble-138361.html
Contents of This Page
Troubleshooting Guides
Quick Tips!
Troubleshooting Tools
Pertinent Articles
Pertinent Blogs
Pertinent Forum Sites
(4) https://www.ibm.com/developerworks/cn/java/j-nativememory-linux/
(7) https://www.azulsystems.com/resources/presentations
(8) https://blogs.oracle.com/jonthecollector/entry/our_collectors
(10) https://www.javaworld.com/javaworld/javatips/jw-javatip92.html
(12) https://www.ibm.com/developerworks/java/library/j-codetoheap/index.html
(13) https://www.oracle.com/technetwork/java/javase/tech/index-jsp-136373.html
(14 )https://java.sun.com/performance/reference/whitepapers/tuning.html
4. java.lang.StackOverflowError 5. out of memory in Native Code (C-heap)!
1.
[Full GC[PSYoungGen: 279700K->267300K(358400K)][ParOldGen: 685165K->685165K(685170K)]964865K->964865K(1043570K)
[PSPermGen: 32390K->32390K(65536K)],0.2499342 secs]
[Times: user=0.08 sys=0.00, real=0.05 secs]
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
[Full GC[PSYoungGen: 0K->0K(141632K)][ParOldGen: 132538K->132538K(350208K)]32538K->32538K(491840K)
[PSPermGen: 65536K->65536K(65536K)],0.2430136 secs]
[Times: user=0.37 sys=0.00, real=0.24 secs]
java.lang.OutOfMemoryError: PermGen space
-Xss256k
-XX:+UseConcMarkSweepGC
-XX:+UseParNewGC
-XX:+CMSParallelRemarkEnabled
-XX:+UseCMSCompactAtFullCollection
-XX:+UseCMSInitiatingOccupancyOnly
-XX:+UseFastAccessorMethods
注意:UseParNewGC(ParNew+Serial Old),该选项实际上被后面的并发标记GC(ParNew + CMS +Serial Old)选项覆盖掉了~有些参数,尤其是带radio或Threshold的,比方说MaxTenuringThreshold,InitialTenuringThreshold,InitialSurvivorRatio,MinSurvivorRatio, SurvivorRatio,MaxHeapFreeRatio,MinHeapFreeRatio,NewRatio,我们需要针对具体应用调优,记住,调优是件很伽利略的事情~
后记:在NIO使用场景比较多的情况下,-XX:+DisableExplicitGC可能会有副作用。如果担心System.gc()调用造成fullGC频繁,可以尝试XX:+ExplicitGCInvokesConcurrent参数。在Full gc的时候会对old gen做reference processing,进而能触发基于PhantomReference的清理对象Cleaner对已死的DirectByteBuffer对象做清理工作。
最近在研究JIT运行期性能优化,发现了JITWatch这个不错的工具,记录一下(关于JITWatch的更详细的功能,可以参看这里的视频)。本来呢,通过hsdis插件获得HotSpot执行时产生的汇编代码也是一种不错的选择(如早期,我就喜欢这样玩,java -server -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly -XX:+DebugNonSafepoints DemoVolotile > demo.assembly),无奈如果希望全盘看懂那些汇编代码还是有些够呛,毕竟自己那些汇编知识毕业后都还回去了,也没有系统的拾起来过。
最后更新:2017-04-02 06:52:21