File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes deploy more than 1 app on an instance? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "deploy more than 1 app on an instance?" Watch "deploy more than 1 app on an instance?" New topic

deploy more than 1 app on an instance?

jake voit

Joined: Mar 05, 2004
Posts: 3
is it a good idea to deploy more than 1 application per tomcat instance (we are using tomcat 4.1.30)? i don't want an error in 1 application to cause an outage in another. However, I don't want to start having tomcat instances on servers throughout the company.

how about having multiple tomcat instances on a single machine and using a reverse proxy to make all of the applications appear to be comming from a single port?
[ June 14, 2004: Message edited by: jake voit ]
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
The whole design of the servlet API is aimed at keeping different "web applications" separate while being run in a single JVM. Thats why there is such elaborate error catching and reporting within Tomcat.

The only reason I can think of to have multiple tomcat instances running on one computer is if they are watching different ports. I have a couple of instances running right now for that reason - one on port 80 for normal visitors, one on another port so a client can test it.

Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

There are several valid reasons for wanting separate Tomcat instances, most of them related to wanting separate JVMs .

1) Memory management. What if you have a misbehaving application that gobbles memory until the dread OutOfMemoryError ? That will affect all applications under a single Tomcat, not only just the bad one.

2) jvm switches. Different applications will have different needs. Perhaps one needs ALOT of memory, and finely tuned garbage collection. Perhaps these setting are inappropriate for the other applications hosted by that Tomcat.

3) Service levels. Related to 1, but "anything else" that might cause trouble with the VM as well. If your apps *must* be up, then you'll want to manage each one separately. If you need to bring down a single app and reload it, you can effectively do so without worrying about the other apps. Yes, I know Tomcat can reload single apps... but there is an associated and unavoidable memory leak with this approach.

4) System.exit. My personal favourite. A malicious app can cause Tomcat to go away. Having a proper security policy would prevent this, but as additional protection, there's nothing like separate VMs.

None of these reasons touch on other things like 'load balancing'.

Having said all that.. at work we have only 3 instances of Tomcat for about 15 apps. So we do indeed have more than one on a single instance.
I agree. Here's the link:
subject: deploy more than 1 app on an instance?
It's not a secret anymore!