Is there a way to save the JAVA JIT information for the next run so that i don't have to warm up the code every day?

我是研究僧i 提交于 2019-11-30 16:43:12

问题


I have a JAVA process that runs every day and takes about 1,000 or 2,000 hits before it is fully optimized by the JIT. What I'd like to do is save the JIT info so that the next day it can start in an optimized state. It seems like this should be possible, but I have not been able to find any method for doing so.


回答1:


You could use an ahead-of-time compiler like JET or GCJ, but I don't believe there's any standard way to save the JIT form. Keep in mind that this ties your program into the architecture you're running on, but it sounds like you're aware and accepting of this.




回答2:


One option is to control the number of invocations needed for a method to be considered eligible for JIT compile.

-XX:CompileThreshold (default 10000).

You could play around various values to tune up with your application.

Please note that setting this to ZERO is NOT recommended.




回答3:


Can you just keep your app running? What happens if you just have your app sleep until the next day rather than shutting down? You will then save time starting up the JVM as well as potentially skipping the jitting phase.



来源:https://stackoverflow.com/questions/2178640/is-there-a-way-to-save-the-java-jit-information-for-the-next-run-so-that-i-dont

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