tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Why we need two servers (httpd and tomcat)
Date Mon, 27 Apr 2009 19:21:25 GMT
Leon Rosenberg wrote:
> I'm sorry, I can't shut up my mouth on this, but you are telling myths :-)
And anyway, you just all forget this Java nonsense, and use Perl, as 
Real Programmers do.

That's just kidding of course, but let's keep a sense of perspective.

If you just want to run jsp pages and java servlets, then you need 
Tomcat (or another servlet engine), and there is no reason to add an 
Apache httpd in front. It would just complicate and slow down things.

If you need to serve some static content in addition to running your jsp 
pages and servlets, then there is still no need to put an Apache httpd 
in front of Tomcat, it can do that fine too by itself.

If you need several Tomcats to take the load, and you need to balance 
the calls to them, then you need a load-balancer in front; whether you 
want to use Apache httpd for that, or some other device/software is 
dependent on other factors. And if you want to use Apache, you can still 
choose between mod_proxy_http, mod_proxy_ajp or mod_jk.

If you do not need to run jsp pages and servlets, then you don't need 
Tomcat at all, and you'll be better off with Apache httpd alone.

If you need to run PHP or Perl or other non-Java applications, then you 
need Apache httpd, because Tomcat can't do that with anywhere near the 
same kind of speed and flexibility.

Now apart from the ideal clear-cut cases above, in the real world there 
are many cases where what you need to do is a mixture of all that, and 
that's where an Apache httpd/Tomcat combination may be the best choice.
And that's also where the versatility of Apache httpd comes into play, a 
versatility which Tomcat does not match and probably never will, because 
the purpose of each is different.

Where Tomcat is designed to be a Java servlet engine, Apache httpd is 
designed for being a "swiss-army-knife" webserver. And it is free too 
(contrary to a hardware load-balancer).
As much as Tomcat can also serve static content (and in simple cases do 
it well and efficiently), Apache httpd can do everything that Tomcat can 
do (except running Java applications).  And then it can do a lot of 
extra things that Tomcat cannot, and it can do it almost out of the box, 
with a configuration which does not require being a Java expert.
And it is used by about 50% of all websites on the WWW, for a total of 
some 100 Million. So it must be doing something right.

And not everyone can afford a server farm.

The point is, Apache httpd /can/ be a front-end to Tomcat, forwarding 
what needs to be and serving the rest either locally or by proxying it 
somehere else, do the authentication on behalf of itself and of Tomcat 
with just about any back-end imaginable, balancing between several 
back-end Tomcats, modifying requests to Tomcat on-the-fly and modifying 
Tomcat's responses if need be also, cache responses, negotiate content,
track user activity and whatnot, and that is all just with the standard 
modules available directly within the standard Apache distribution.

Tomcat cannot do the same for Apache.  And it does not want to do it, 
because its focus is on being a good java servlet server, not on being a 
universal webserver like Apache httpd wants to be.

Now maybe in another 10 years, Tomcat will be able to do all these 
things too.  But by then maybe Java will be out of fashion (remember 
Pascal, PL/1, RPG ?) and all decent webservers will be written in Erlang.

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

View raw message