On Mon, 30 Jul 2001, Richard Draucker wrote:
> The following is a cut'n paste from "tomcat/doc/uguide/tomcat_ug.html".
> If you have tomcat installed, look for this doc and provide this text to your
> sys admin.
>
> Setting Tomcat to Cooperate with the Apache Web Server
> Tomcat is not as fast as Apache when it comes to static pages. Tomcat is not
> as configurable as Apache. Tomcat is not as robust as Apache.
>
Don't believe everything you read ... even in the Tomcat docs :-).
There is no cut-and-dried answer whether Tomcat standalone or
Tomcat+Apache will run faster for *you*. There are far too many variables
for simplistic answers to always be accurate. The best thing to do is try
your application both ways and see.
Just a few examples of how real life confounds answering a question
like this: :-)
* Many web applications written with servlets and JSP pages are
95-100% dynamic content. If your app is like that, static file
serving speed is not relevant, or may not be significant enough
to make any difference in overall response time.
* Under normal circumstances, thre *browser* will cache static files.
If it does so, the fact that Apache might also do so is not relevant
as long as Tomcat sends back the "Not Modified" response correctly
(Tomcat 4 does this, for example, with zero disk accesses).
* You don't want Apache caching the output from dynamic resources
(servlets and JSP pages), because the whole point of them is that
the contents will change.
* You can, in your servlet/JSP page, implement the getLastModified()
method yourself to let the browser cache your dynamic pages. This is
very useful for "dynamic" pages that don't change very often.
Of course, there are many non-performance-related reasons you might be
required to use Apache in conjunction with Tomcat (if you need the other
functionality that it provides). But, if you don't, you owe it to
yourself to see if Tomcat stand-alone runs fast enough before undertaking
the extra pain it takes to configure them to run together.
Craig McClanahan