We have a Spring MVC web application deployed on Tomcat 7. Every time I deploy a new build, it runs very slowly for first time. Even the login page takes time to come up.
What would be the reason for this and what can be done to make it faster?
This is a valid scenario. Your server load the servlets and action on first heat. So it will be slow on first access.
You can set the <loadonstartup>1</loadonstartup>
in web.xml.
The above option will load required files on server startup.
If you are using Spring annotations make sure you have the correct packages configured in the <component:scan /> tag. That is do not include the same package(s) to scan in applicationContext.xml and xxx-servlet.xml file. Spring will scan them twice otherwise, I have seen this.
Also remember any JSPs will be compiled the first you use them, so this will be slower on first hit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With