Use static methods where applicable. A method declared static tends to execute faster
than any other type of method declaration. Next are final methods, followed by instance
methods, and last, synchronized methods.
5.5.2 Apache and Tomcat Web Server Integration
The Tomcat web server can serve both static and dynamic web pages. However, if a web site
contains a significant number of static pages, using the Apache web server for the static content
can increase the application's performance. The Apache web server is also an open source
product developed by the Jakarta project (like Tomcat).
Besides the performance increase, there are several other reasons that make the combination
of Apache with Tomcat a good choice:
The Tomcat web server is not as configurable as Apache.
Tomcat is not as robust as Apache.
Apache provides some additional functionality that cannot be found under Tomcat (e.g.
modules for Perl or PHP).
When running in combination with Apache, Tomcat is configured as an add on to the Apache
web server. Apache and Tomcat work together in the following way: Apache serves as the main
web server that listens for client requests. Before Apache processes a request, the request is
checked whether it refers to a dynamic web page (a servlet or JSP page). If a servlet or JSP
page is requested, Apache forwards the request to the Tomcat web server, which processes it.
Otherwise, Apache directly serves the request.
To achieve this behavior, both Apache's and Tomcat's configuration files have to be modified.
Furthermore, an additional module has to be added to the Apache environment (either
mod_jserv or mod_jk the latter is the newer module, it is easier to configure and can handle
the secure https protocol).