Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I reduce the cold start time of a Spring MVC application?

I've switched from classpath scanning of Controller 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.

like image 209
Damien Avatar asked Nov 14 '22 08:11

Damien


1 Answers

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.

like image 125
The Alchemist Avatar answered Dec 16 '22 20:12

The Alchemist