Reputation: 87
Is there any config in tomcat where in I can mention that start all application at same time when tomcat restarts. This is to avoid latency during tomcat restarts.
Upvotes: 3
Views: 2424
Reputation: 16660
The best you can do is configure a suitably large startStopThreads
setting for the <Host .../>
element in server.xml
so each Context
starts in a parallel thread.
How successful this is will depend on how many cores you have on your system compared to the number of web applications and the relative start times of each web application.
Full details of the startStopThreads
are available in the Tomcat Documentation.
Upvotes: 8
Reputation: 48087
They all start automatically, I'm not sure what else you need.
AFAIK they're started sequentially, one after the other - probably this is what you're aiming at. I'm not aware of a multi-threaded concurrent start, but even if this would be the case, they'd all have an individual startup time anyways, so you might shorten the time, but still have the same problems.
You can counter any problem by making your tomcat available to the outside world only when it has fully been started up (e.g. through proper loadbalancer configuration). If your applications take too long to inintialize, you might want to work on this issue as well.
Upvotes: 1