You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Townsley, Charlotte" <ch...@eds.com> on 2008/04/15 20:38:40 UTC

Webapps and supporting multiple sites

We are in the process of re-designing our web applications. Our new
design uses Tomcat/Apache and must support 100+ separate websites. I am
new to Tomcat and have some basic, early project questions.

Can a Tomcat Webapp effectively support 100+ websites? I've seen cases
where a Webapp can be configured to support multiple websites, but
nothing close to this number of sites. 

What are some recommended configuration options for supporting such a
large number of sites? Multiple Webapps? Multiple Tomcat instances?




Re: Webapps and supporting multiple sites

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlotte,

Townsley, Charlotte wrote:
| Some of the applications do have unique domain names, but they resolve
| to the same IP in DNS, and then usually redirect to a subdirectory
| within the same domain. This redirect is accomplished with a mod_rewrite
| rule in a VirtualHost host entry within httpd.conf.

So, this is basically one application available to dozens of virtual
hosts? No problem:

1. Run your single application on a single Tomcat instance.
2. Configure "localhost" as the default <Host>.
3. Send all appropriate Apache httpd requests through the same
~   mod_jk worker (only a single worker is required).

The fact that you have many many DNS names is pretty much irrelevant as
far as webapps are concerned. Whenever possible, run as few webapps as
possible. You'll require less memory and management will be much easier.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgGt8EACgkQ9CaO5/Lv0PDkYACZAVKHKBBcQZjp92yJFV14UfVx
W2IAoJlkCTsBsUt2/Hce5m0hN+4DKEla
=wq1T
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Webapps and supporting multiple sites

Posted by "Townsley, Charlotte" <ch...@eds.com>.
Thank you for your response. It is very helpful.

Some of the applications do have unique domain names, but they resolve
to the same IP in DNS, and then usually redirect to a subdirectory
within the same domain. This redirect is accomplished with a mod_rewrite
rule in a VirtualHost host entry within httpd.conf. 

Tomcat is actually running one large code base (equal to "appbase"?)
through a 3rd party application for content management. It seems like
the plan would be to make sure that localhost is set as the default host
and then use apache as the entry point with connectors. Tomcat's
server.xml file, at least as it is bundled with our content management
app, already contains a mod_jk entry. 

So all of this should work out..hopefully. 


-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: Wednesday, April 16, 2008 11:08 AM
To: Tomcat Users List
Subject: Re: Webapps and supporting multiple sites

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlotte,

Townsley, Charlotte wrote:
| We are in the process of re-designing our web applications. Our new 
| design uses Tomcat/Apache and must support 100+ separate websites. I 
| am new to Tomcat and have some basic, early project questions.
|
| Can a Tomcat Webapp effectively support 100+ websites? I've seen cases

| where a Webapp can be configured to support multiple websites, but 
| nothing close to this number of sites.
|
| What are some recommended configuration options for supporting such a 
| large number of sites? Multiple Webapps? Multiple Tomcat instances?

The real question is the number of applications, not the number of "web
sites" (which usually means domain names). Are you using "web sites" as
a synonym for "applications" in this case?

If not, configuration is easy: just load whatever applications you want
into the "localhost" <Host>, and make sure that "localhost" is set as
the default host. That way, Tomcat will respond to a request for your
selected webapps no matter what hostname they are trying to reach.

If you /are/ talking about 100+ different hostname/webapp mappings (that
is, 100+ different web applications each separately deployed on a
particular hostname), then you have a bunch of options:

1. Separate machine for each web site.
~   Here, you have a dedicated machine for each web site/app pair.
~   This is one of the simplest strategies to understand and administer,
~   but requires a lot of hardware. You simply configure each machine
~   separately.

2. All webapps deployed on a single Tomcat instance on a single machine.
~   Here, you have a single instance of Tomcat running all 100+
~   applications. Configure a different <Host> in server.xml for each
~   of your hostnames, make sure each has a separate "appBase" (which is
~   where the applications for that host name live on the disk).
~   This is also easy to understand (and implement), but requires that
~   all applications/sites be taken down together if there is a problem
~   that requires a restart. It will also require a lot of memory to
~   run all those applications on a single machine.

3. Single machine, multi-Tomcat.
~   Here, you run a separate instance of Tomcat for each application/web
~   site. They are all running on the same physical machine, but running
~   as separate processes and can therefore be stopped/started
~   independently. This is very flexible (especially because each
~   app/web site can be moved to another machine trivially), but
requires
~   /much/ more memory because of the multiple copies of JVMs running
all
~   at once.
~   See the "Advanced" section of RUNNING.TXT that comes with the Tomcat
~   distribution for details on how to do this.

4. Multiple separate Tomcat instances, multiple apps on each.
~   This is essentially 50% #2 above and 50% #3 above. Instead of
~   configuring only a single application/web site per Tomcat instance,
~   you deploy maybe 10 or 20 on each Tomcat instance. This gives you
~   more limited effects if one of the JVMs goes down (only 10 apps are
~   down instead of all of them) but has lower memory requirements.

5. Combinations of the above. If you don't think a single machine will
~   be able to handle all your traffic or all the processing power
~   required, you might want to split applications onto different
~   physical machines. Once you have separate physical machines, you
~   can use any of #2 or #3 or #4 above.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgGQH8ACgkQ9CaO5/Lv0PCfpwCgnfqCzCtCyx6t96jW+v1AZRGR
phsAnjPQ4xhGy1H070I8X3QMyeb7yGt6
=+Fsu
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Webapps and supporting multiple sites

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlotte,

Townsley, Charlotte wrote:
| We are in the process of re-designing our web applications. Our new
| design uses Tomcat/Apache and must support 100+ separate websites. I am
| new to Tomcat and have some basic, early project questions.
|
| Can a Tomcat Webapp effectively support 100+ websites? I've seen cases
| where a Webapp can be configured to support multiple websites, but
| nothing close to this number of sites.
|
| What are some recommended configuration options for supporting such a
| large number of sites? Multiple Webapps? Multiple Tomcat instances?

The real question is the number of applications, not the number of "web
sites" (which usually means domain names). Are you using "web sites" as
a synonym for "applications" in this case?

If not, configuration is easy: just load whatever applications you want
into the "localhost" <Host>, and make sure that "localhost" is set as
the default host. That way, Tomcat will respond to a request for your
selected webapps no matter what hostname they are trying to reach.

If you /are/ talking about 100+ different hostname/webapp mappings (that
is, 100+ different web applications each separately deployed on a
particular hostname), then you have a bunch of options:

1. Separate machine for each web site.
~   Here, you have a dedicated machine for each web site/app pair.
~   This is one of the simplest strategies to understand and administer,
~   but requires a lot of hardware. You simply configure each machine
~   separately.

2. All webapps deployed on a single Tomcat instance on a single machine.
~   Here, you have a single instance of Tomcat running all 100+
~   applications. Configure a different <Host> in server.xml for each
~   of your hostnames, make sure each has a separate "appBase" (which is
~   where the applications for that host name live on the disk).
~   This is also easy to understand (and implement), but requires that
~   all applications/sites be taken down together if there is a problem
~   that requires a restart. It will also require a lot of memory to
~   run all those applications on a single machine.

3. Single machine, multi-Tomcat.
~   Here, you run a separate instance of Tomcat for each application/web
~   site. They are all running on the same physical machine, but running
~   as separate processes and can therefore be stopped/started
~   independently. This is very flexible (especially because each
~   app/web site can be moved to another machine trivially), but requires
~   /much/ more memory because of the multiple copies of JVMs running all
~   at once.
~   See the "Advanced" section of RUNNING.TXT that comes with the Tomcat
~   distribution for details on how to do this.

4. Multiple separate Tomcat instances, multiple apps on each.
~   This is essentially 50% #2 above and 50% #3 above. Instead of
~   configuring only a single application/web site per Tomcat instance,
~   you deploy maybe 10 or 20 on each Tomcat instance. This gives you
~   more limited effects if one of the JVMs goes down (only 10 apps are
~   down instead of all of them) but has lower memory requirements.

5. Combinations of the above. If you don't think a single machine will
~   be able to handle all your traffic or all the processing power
~   required, you might want to split applications onto different
~   physical machines. Once you have separate physical machines, you
~   can use any of #2 or #3 or #4 above.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgGQH8ACgkQ9CaO5/Lv0PCfpwCgnfqCzCtCyx6t96jW+v1AZRGR
phsAnjPQ4xhGy1H070I8X3QMyeb7yGt6
=+Fsu
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org