我正在运行带有-XX的jvm:+ PrintSafepointStatistics,-XX:+ PrintGCApplicationStoppedTime和-XX:+ PrintGCApplicationConcurrentTime等来调查gc暂停。我注意到了
vm暂停比gc暂停大很多,占总数的90%。
虽然大多数暂停都是低延迟,但我发现有几个vm暂停会停止我的应用程序持续很长时间。
使用PrintSafepointStatistics标志进行进一步调查(如本博客中所述:http://jpbempel.blogspot.in/2013/03/safety-first-safepoints.html),我发现了一个特定的vm-op" PrintThreads"导致暂停时间长达4.5和1.3秒。
我想知道是什么触发了这个vmop,为什么它占用了这么多时间。如果它有帮助,下面是我正在使用的所有jvm标志的列表:
JAVA_OPTS =" $ JAVA_OPTS -XX:+ UseParallelOldGC"
CATALINA_OPTS =" -Xms2G -Xmx4G -XX:MaxPermSize = 256m -Xloggc:/path/to/tomcat/apache-tomcat-8.0.18/logs/gc.log -XX: + PrintGCDetails -XX: + PrintGCTimeStamps -XX:+ PrintTenuringDistribution -XX:+ PrintGCApplicationStoppedTime -XX:+ PrintGCApplicationConcurrentTime -XX:MaxNewSize = 1638m -XX:NewSize = 1638m -XX:+ PrintSafepointStatistics -XX:PrintSafepointStatisticsCount = 1"
gc.log中的应用程序停止时间输出(相关部分):
1649.008: Application time: 0.0001730 seconds
1649.009: Total time for which application threads were stopped: 0.0003760 seconds
**1650.805**: Application time: 1.7963630 seconds
1655.315: Total time for which application threads were stopped: **4.5099710 seconds**
1655.315: Application time: 0.0000350 seconds
1655.316: Total time for which application threads were stopped: 0.0005540 seconds
1655.316: Application time: 0.0001600 seconds
catalina.out中相应的安全点统计信息(相关部分):
vmop [threads: total initially_running wait_to_block] [time: spin block sync cleanup vmop] page_trap_count
1649.008: RevokeBias [ 165 0 0 ] [ 0 0 0 0 0 ] 0
vmop [threads: total initially_running wait_to_block] [time: spin block sync cleanup vmop] page_trap_count
**1650.805**: PrintThreads [ 168 0 0 ] [ 0 0 0 0 4509 ] 0
vmop [threads: total initially_running wait_to_block] [time: spin block sync cleanup vmop] page_trap_count
1655.315: PrintJNI [ 168 0 0 ] [ 0 0 0 0 0 ] 0
应用程序线程停止4.5秒之前的上一个时间戳是 1650.805 。此时间戳对应于" PrintThreads"在catalina.out中的vmop。我已在多个实例中验证了这一观察结果。大于1秒的暂停总是由" PrintThreads" vmop。
提前致谢。
答案 0 :(得分:1)
你能告诉我关于PrintThreads vmop的更多信息,比如什么时候或为什么会被触发?
有几种方法可以触发它
JVM_DumpAllStacks
DiagnosticCommandMBean
只是推测,但是如果有什么触发器,vmop通过网络连接写入它,而另一端的任何东西都很慢,那么这可能会阻止整个VM。