tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Wiseley" <>
Subject Fwd: Re: adding hosts without restarting
Date Thu, 15 May 2003 14:42:50 GMT
Ahhh... put IIS or Apache in front of it and the port sharing problem goes away. Excellent.
I actually needed to know how to do this for two reasons. One was for an IIS/Tomcat environment
with 10 developers. This solution is good for that as it's only 10 and since development is
going on, it's worth having everyone in their own JVM.

This solution isn't a good one for the ASP, however, as I need hundreds, if not thousands,
of these sites running on a single server. Nobody is editing code in any of these sites, and
all sites run the exact same code, differing only in which database they talk to and which
XSL stylesheets they use, so separation isn't as much of a concern.

For the benefit of future readers of this thread... I've decided to use Jetty, another open-source
servlet container, for that project for a few reasons: 

1. it has a much smaller footprint than Tomcat... both disk and more importantly, memory.
2. it provides a robust HTTP server, so no IIS/Apache overhead
3. it is easily controlled from Java code... in about 2 hours last night I wrote a Java server
that created an instance of Jetty and could add, stop, start, and delete virtual hosts without
bringing the whole thing down. Basically, you can very easily write your own wrapper for the
server that does whatever you want.

Thanks John... I'll be implementing the multiple tomcat isntance for the dev project, so I
appreciate your input!


----- Start Forwarded Message -----
From: John Turner <>
Subject: Re: adding hosts without restarting

Right.  It's own JVM, it's own server.xml, it's own work directory.  Only 
one set of bin files (CATALINA_HOME/bin).  There is a file in the Tomcat 
distro called RUNNING.txt that has a section on doing this.  Basically, you 
set CATALINA_BASE to whatever CATALINA_HOME would be in a single-instance 
environment, then you set CATALINA_HOME for each instance to a different 
location than CATALINA_BASE.  There are some other resources on the net, 
too.  You can also just install Tomcat multiple times, as described here:  Disk is cheap.

I'm pretty sure the only way you can do this is with using Apache in 
conjunction with Tomcat.  That way Apache is the service listening on the 
IP address.  Then in your httpd.conf file, you send your dynamic (Tomcat) 
requests to different ports by setting up a worker for each Tomcat, based 
on name-based virtual host.  That way, you can have as many Tomcats as 
resources will allow.  One of my servers is a dual P3-1.3, with 4GB RAM, 
and it is hosting 22 Tomcat instances just fine, under medium to high load 
with a very resource intensive (lots of disk I/O) application.

I can't take credit for the was designed by others more fluent 
in Tomcat than I...I just maintain it.  I can say that it works great, 
though.  Fairly easy to administer, very stable, though a lot of the 
stability is driven by application behavior, which in our case is very 

I haven't spent a lot of time with Tomcat 4 (the setup above is Tomcat 3) 
and many virtual hosts, so I can't say for sure how easy/hard it would be 
to do this in 4, but my guess is that it should be fairly direct.  My 
current Tomcat 4 setup just uses one Tomcat instance with multiple virtual 
hosts, as its for internal (no resale) use.


On Thu, 15 May 2003 12:50:33 GMT, Matt Wiseley <> wrote:

> John,
> It sounds as if that is the solution I am looking for. When you say 
> "instance" do you mean full-blown tomcat running in it's own JVM with 
> it's own server.xml? Is there anything on the web that talks about what's 
> involved in doing this? I don't understand how multiple tomcat instances 
> can share the same IP address. Any tips you have from your experience in 
> doing this would be a great help.
> Thanks,
> Matt
>> The scenario you describe is exactly the environment I have.  I work for 
>> an ASP.  We avoid this by giving each client their own Tomcat instance.  
>> Server overhead is minimal, and each Tomcat isntance can be stopped or 
>> started independently of any others to facilitate maintenance and other 
>> changes, which are handled during regularly scheduled maintenance 
>> windows.
>> John
>> On Thu, 15 May 2003 03:25:47 GMT, Matt Wiseley <> wrote:
>> > Jake,
>> >
>> > Thanks for your reply. I would assume that it would require a restart 
>> if > there weren't JMX beans and an admin web tool that can add hosts, > 
>> presumably without a restart.
>> >
>> > Different ports wouldn't do. Here's the issue. An application service 
>> > provider (call it offers their service as a customized web 
>> site > for clients. Client A would pay for their site at 
>>, which > is a virtual host running on the same port (80) 
>> and IP as
>> >
>> > The service provider allows clients to purchase this service on their 
>> web > site and they need to add the new site and have it working as part 
>> of the > transaction, so restarting tomcat doesn't fly.
>> >
>> > I know both Weblogic and Websphere (and IIS for that matter) offer > 
>> methods of doing this w/out restarting... and it seems as though Tomcat 
>> > does too. I just can't seem to find anyone who has done it.
>> >
>> > Matt
>> >
>> >
>> >>
>> >> This will almost certainly require a restart.  Did you read Tomcat's 
>> >> docs thoroughly?  If not, that is where to look.
>> >>
>> >> Oh, well there is one way.  You can start completely separate 
>> instance >> of Tomcat on different ports.  You can use CATALINA_BASE to 
>> specify each >> the location of the separate instance(s).  This allows 
>> you to have a >> base install of Tomcat, but provide completely separate 
>> configurations >> and appBase's per Tomcat instance.  Is that what you 
>> are looking for?
>> >>
>> >> Jake
>> >>
>> >> At 09:48 PM 5/14/2003 +0000, you wrote:
>> >> >I have to believe this has been asked a million times, but I can 
>> find >> no >solution in the archives. I am running 4.12 stand-alone and

>> need to >> be >able to add virtual hosts (new individual sites with a 
>> new host name >> and >root context) on the fly without restarting 
>> tomcat. I know that >> this >should be technically possible because the

>> web admin tool has this >> >capability. Unfortunately, I'm not familiar

>> with Struts, so that source >> >code didn't help me much.
>> >> >
>> >> >I understand that contexts within an existing host can be added in 
>> >> >numerous ways, but I need to add new hosts.
>> >> >
>> >> >Has anyone implemented a method of doing this, say from Java code or

>> >> from >a command line (Ant)? It would greatly help me out.
>> >> >
>> >> >Thanks in advance,
>> >> >Matt
>> >> >
>> >> >
>> >> >---------------------------------------------------------------------

>> >> >To unsubscribe, e-mail:
>> >> >For additional commands, e-mail:
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail:
>> > For additional commands, e-mail:
>> >
>> >
>> -- Using M2, Opera's revolutionary e-mail client: 

Using M2, Opera's revolutionary e-mail client:

----- End Forwarded Message -----

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message