JVM JIT deoptimization after idle

梦想的初衷 提交于 2019-12-24 06:01:52

问题


I use Java primarily for writing pet projects, which are idle most of the time. And after being idle for hours/days response time increases to seconds (up to 10s), then slowly decreases back to 200-300ms.

As far as I understand, this happens because of JIT deoptimization (optimized code becomes marked as a zombie, removed and later compiled again).

Is there any way to forbid JVM to deoptimize code unless code cache is full? Java 9's AOT looks like the best solution for this case, but I still haven't managed to make it work.

UPD: And as always, the right solution is the obvious one. Looks like the problem was actually caused by swap. Despite 12 GB of ram, 6 of which were free, about 100 MB of every JVM's memory was swapped to HDD after a while.

Nevertheless @apangin's answer can be useful for someone else who run into the same situation, so I leave this question here. Thanks all!


回答1:


-XX:-UseCodeCacheFlushing disables sweeping compiled methods altogether.

Though this is the answer to the given question, I highly doubt this will resolve your original problem.

When an application is idle, NMethod sweeper is also idle. It is also unlikely that JIT compilation is so slow that it takes tens of seconds before the hot code is (re-)compiled. Flushed file caches, stale network connections etc. are more likely reasons for such slowdowns.



来源:https://stackoverflow.com/questions/43464971/jvm-jit-deoptimization-after-idle

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