Kapila
Kapila

Reputation: 87

Deploying Multiple Spring Boot Web Applications in Single Server

I have 5 Spring Boot web applications but have only one Server (low-end).

What is the best way to deploy all 5 in one Server? Having only one web container (Tomcat) and deploy all of them as separate war files on the same Tomcat or run all 5 on different Tomcat containers (Spring Boot default behavior)?

What is your recommendation by considering performance and maintenanability?

Upvotes: 1

Views: 6539

Answers (4)

JSas
JSas

Reputation: 126

From my experience, using container such as docker is the easiest way to maintenance multiple spring-boot applications. When you have a new server, it can be migrated easily, and the application can be updated without interrupting other applications. But you may need to spend extra time to learn how to use the container.

If using Tomcat, it is recommended to separate the tomcat instances. One tomcat for each WAR file. Putting multiple WAR files in one tomcat can make the maintenance difficult. Tomcat hot deployment / auto deploy tends to have some errors which require you to restart the whole tomcat

Upvotes: 0

Luis Muñiz
Luis Muñiz

Reputation: 4811

If you have little resources on your server, you don't have much choice. Each Java virtual machine has a significant overhead, so running separate containers will make you reach the limits of your low-end server earlier.

You will have to deploy your wars in the same tomcat server, with different servlet contexts.

However, if you have sufficient RAM, the cleanest way in my opinion is creating docker images and running the standalone spring-boot jars in each container.

Upvotes: 1

GreyBeardedGeek
GreyBeardedGeek

Reputation: 30088

IMHO, if you're running a resource-constrained server, your best bet is to deploy all of your applications as war files under a single tomcat instance. Running multiple servers would just add un-needed overhead.

Upvotes: 1

Ele
Ele

Reputation: 33726

My recommendations are:

  • If these WARs are independent of each other, deploy them in a different Web server, not only Tomcat or whatever container you're using, but also in either different virtual server, dedicated server or Cloud instances.
  • Deploying in different "virtual server" you can scale horizontally, so this is good for future workloads.
  • Deploy a load balancer from your hosting provider, or you can use Nginx for doing that.

Hope this helps!

Upvotes: 0

Related Questions