What is the best practice when hosting more than one tomcat based web application

I understand that using the same tomcat instance for multiple web applications has some risks (for example, if one web application crashes tomcat, it will also stop working with other web applications.). The advantage is, of course, cost-effectiveness, since one server is enough, and all web applications in one place simplify administration.

Are there any industry recommendations on how a good setup with multiple tomcat web apps should look like?

+4
source share
2 answers

Pros

  • One JVM for monitoring
  • Shared libraries can be shared (sometimes risky)

Against

  • The common HTTP thread pool used by all applications (you can, however, configure multiple connectors with different thread pools)
  • One failed application can delete the entire server
  • When you restart one application, you must restart all of them (if you do not use hot deployment)
+1
source

You are right that hosting multiple applications on one application server / web container (or Tomcat or another) has advantages.

You mentioned a reliability issue where one application can cause another to crash. But let it simplify: even if you have only one application, you still need 24 * 7 availability. To achieve this, people usually run more than one instance of the application server with the same application on each of them and a load balancer at the entrance to the site . The same applies to multiple web applications. Just run N (at least) application servers with the same set of deployed web applications and a load balancer. You probably need some kind of watchdog timer that restarts the server if it is not working, or if it stops responding, etc.

In some cases, clustering is required. But this is a different story.

+1
source

Source: https://habr.com/ru/post/1412562/


All Articles