This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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 ]
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.
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.