• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Tomcat restart takes eternity

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hello Everyone

I need your help.

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
Red Hat Enterprise Linux Server release 7.3 (Maipo)

Thanks in advance !

Saloon Keeper
Posts: 6522
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Shwetank Upadhyay
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks in advance!
Saloon Keeper
Posts: 22273
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
We can walk to school together. And we can both read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic