Gustavo Mejia at [EMAIL PROTECTED] wrote:
> Hi !
> Hello everybody,
>
> I have an other newbie and maybe dumb question, I was reading that
> Tomcat also has a Webserver functionality, is it right ?? I think it is
> , well, why I is good to install it on Apache server, which is the main
> advantage ? Why not just Tomcat ?
>
> Thanks a lot for all your support !
Ok, I'll try to sum up all today's questions in one big reply :)
Yes, Tomcat CAN be used in stand-alone mode, meaning YOU DON'T NEED TO HAVE
THE APACHE WEB SERVER to make it work. Both versions, 3.x and 4.0 include an
HTTP protocol handler, so, it can be used as a web-server per se... It will
server all your static HTML pages, and comes packaged with a shitload of
features (like, for Tomcat 4.0, you can handle HTTP/1.1 requests, it
contains a WebDAV web-application, it can run on port 80 without being root
on UNIX systems, and so on, the list continues for pages)
Why, then, do you want to use Apache TOGHETHER with Tomcat? Simple: Apache
comes already with a bunch of systems, and in some environments (such as
MacOS/X) it's tight integrated with the OS. It's fast, _really_ fast (it's
written in C, so performances are outstanding) and it has a lot of features
that are not available in Tomcat stand alone (like, you want to use MOD_PERL
modules - not CGIs, CGIs are supported in TC4.0 stand-alone too, or PHP).
To "integrate" Apache and Tomcat, you will need a "dual" installation: You
have to have Tomcat up and running in stand-alone mode, you have to have
your Apache up and running as a web-server, and you need to add a new module
within your Apache web-server to make them talk together. Modules doing this
job are:
- mod-jserv (coming from the old Jserv days, no troubles, no fuzz, it
WORKS!)
- mod-jk (reliable, with a bunch of features, but I never sorted out how to
install it and debug it - ok, I'm dumb)
- mod-webaap (new one, only available for Tomcat 4.0, currently in ALPHA,
available only for _real_ hackers, please send me bug reports so I can
improve it)
So, my suggestion is: do you need a simple web server for low/medium static
pages hits? Use Tomcat in stand alone mode (I'd make it go for up to 20/30
requests/second)... Need something more (MOD_PERL, PHP) toghether with
servlets OR you have a shitload of static-pages requests (up to 100
requests/second), use Apache AND Tomcat on a single machine.
For _really_ high loads (more than 100/sec) then you're screwed :) At this
point you need to start thinking about load balancing your traffic on
several machines, and when you hit this point you really want to use apache
AND tomcat both load balanced on several hosts, but it gets tricky...
Pier