How can I reduce the cold start time of a Spring MVC application?
I've switched from classpath scanning of Controlle开发者_运维技巧r classes to explicitly declaring the beans, but was wondering what else I can do to cut down on the initial startup of a Spring MVC application.
Not knowing the specifics of your project, I would say your best bet is to profile the startup of your Spring MVC application.
- You can do this using
%JAVA_HOME%\bin\jvisualvm.exe
from the Sun JDK, if that's what you're using. - Netbeans has a good article on profiling Java web application.
- If you are working on an open-source project or have the money, you can use YourKit.
Have you ever profiled before? You should start profiling when your specific webapp starts loading and stop when it's done, if you know it's your web app that is causing the slowdown.
Otherwise, you should profile your entire web container / app server from start to running.
精彩评论