What causes long spin and sync times in Java?

萝らか妹 提交于 2019-12-03 06:20:19
K Erlandsson

The problem here is that it takes your application a long time to reach a safepoint. The Stopping threads output denotes the time it takes between the JVM issues a safepoint request until all threads have reached a safepoint.

The sync value shows same thing - it is the time it takes for all threads to reach the safeponit.

The spin and block values denote the times it takes for blocked and spinning (executing code) threads to reach the safepoint.

Knowing this we can conclude that the problem for you is that one thread is busy spinning and not able to reach its safepoint in several seconds.

Exactly why this occurs is hard to say. An example, as illustrated in this question and it's answer is that the JIT compiler can compile heavy loops without safepoint checks.

You could try running your JVM with the options -XX:+SafepointTimeout -XX:SafepointTimeoutDelay=500. That will timeout the safepoint syncs after 500 ms and print information about the thread(s) that failed to reach the safepoint.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!