Similar question to, “Does it make sense to have multiple tomcat instances on the same server?” but in this case the Tomcats are running on a VM.
I know the answer probably is “it depends,” but I’d like to explore the issue. When does it make sense? What are the VM specific considerations?
Reasons I’ve heard:
1) JVMs are somehow limited in their ability to use the resources available. So allocating more than one instance of tomcat will make better use of resources. Not sure that this is a good reason. Is this one of those things that was once true, but is no longer true?
2) If one instance of tomcat fails, the other can take over.
Downsides:
There’s more overhead when you have multiple versions and greater complexity.
If we need load balancing is it “better” to just put the second tomcat in another VM?
If you have the option, a different VM would be prefered. You still get all the resource utilization benefits you mentioned of multiple JVMs. You ALSO get the redundancy of not having a single point of failure; your VM crashing will not bring down every node in a cluster.
If you HAVE to use one VM, the things to consider when using one tomcat instance vs. multiple are:
The likely scenario is you would be bound by any of the above and you can do whatever you think works best for you. My preference would be in the following order:
2 & 3 in that order just because I don’t want to have to manage more things than necessary. One tomcat is easier than 2 or more. But the best separation is at the server level.