Two Servlet Filters Every Web Application Should Have
Subject:   good idea, wrong layer
Date:   2004-02-21 20:58:27
From:   wrschneider99
Caching and compressing content are important performance enhancements, but they don't belong in the J2EE container. They belong in the HTTP server layer, so that the same filters are not cut-and-paste into multiple applications.

For example, you could put Apache in front of your servlet container, and use mod_gzip and mod_proxy to do compression and caching respectively. In bigger installations, these functions might be performed by a hardware appliance along with SSL acceleration.

You will get a bigger performance boost from caching if cache hits can be handled outside J2EE altogether. Native code (or hardware) will always get cached content to the socket faster than Java will, and the JVM will have fewer requests to handle.