GC日志中的stop-the-world


       通常使用下面的JVM选项在GC日志中打印”stop-the-world”(STW)暂停时间。

-XX:+PrintGCApplicationStoppedTime
       但是在GC日志中看,会发现有许多这样的暂停时间,时间很短,肯定不是垃圾回收引起的。
Total time for which application threads were stopped: 0.0013102 seconds, Stopping threads took: 0.0001792 seconds
Total time for which application threads were stopped: 0.0012521 seconds, Stopping threads took: 0.0001591 seconds
Total time for which application threads were stopped: 0.0008090 seconds, Stopping threads took: 0.0001030 seconds
Total time for which application threads were stopped: 0.0010226 seconds, Stopping threads took: 0.0001058 seconds
       实际上,触发STW暂停的原因除了垃圾回收外,还有一些其他的操作会触发STW,例如一些JIT活动、偏向锁擦除、特定的JVMTI操作,以及许多场景也可能会导致应用程序暂停。
       上述例子中application threads stopped的时间表示应用暂停时间,Stopping threads took 的时间表示等待所有的应用线程都到达安全点花费的时间。只有应用程序线程到达安全点后,JVM才会做些特殊处理,比如垃圾收集、偏向锁擦除等等。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值