I have 34 API deployed on my server. Every time there is a new war deployment, our ansible process restarts the tomcat. Now, bring down 34 API, and then bringing them back up again requires a lot of time. I just want to ask the experts is there any way that the APIs can be deployed and tomcat restart is not needed?
1. Is there a tomcat auto-deploy feature I could use?
2. Is there any way I could restart tomcat by mentioning only the API name which was deployed so that it restarts on that particular API?
I am a DBA so my knowledge on this topic is limited, please help me, experts. Because of this my DevOps Continues deployment process takes twice the time and with increasing APIs, the time will further increase.
Version details: Apache Tomcat server version 8.0.43 with JVM OpenJDK 188.8.131.52
Red Hat Enterprise Linux Server release 7.3 (Maipo)
Welcome to the Ranch. In the future, please resist the temptation to fiddle with font sizes and colors.
Tomcat generally shuts down and starts up pretty quickly. Which part is taking a long time? Are there lengthy initializations being run? If so, you may want to run those in the background so they don't delay startup.
You could also structure the APIs into several web apps, and only restart the web apps that changed. That will eventually lead to problems, though, so I don't recommend it in a production setting.
You could also use an OSGi container like Apache Felix or Apache Karaf which are built on the premise of redeployable services.
posted 1 month ago
Thank you for the reply Tim, much appreciated. Point noted about the font sizes and colors.
1. Regarding the starting up in the background: there is a problem with that approach as the time remains the same, just that it is restarting all the APIs in the background. So the end-user has to wait for the deployed API to be restarted to see the newly introduced change.
Can you please share the steps of how to restart tomcat in the background, I usually do "service tomcat stop/start" with root user.
2. With the second approach, I agree with you that this approach will eventually lead to issues in the prod env. And yes, I have to take this to the prod env.
3. Would you kindly share some documents that can give me more info on the 3rd approach.
Yes, Tomcat starts up and shuts down very rapidly, Some webapps I've seen, however, definitely did not. I worked with one whose startup loaded practically an entire database into RAM before it was ready to handle requests. It took over 20 minutes every time I did a new compile-and-test cycle. I finally got fed up and modified it from pre-loading the database to load-on-demand and the startup time dropped to about 1 minute 30 seconds.
A lot of times you have 2 choices: do everything in advance and have instant response on requests, which, as I noted can take a very long time to start, or do everything just-in-time, so that startup is quick, but requests take longer the first time they're made. Or you can mix the two tactics if that works better overall.
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.
That is a really big piece of pie for such a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!