Re: Servlet caching strategies?
On 20-09-2010 17:12, markspace wrote:
I was poking around the internet looking for caching idea for servlets
and JEE containers. Here's an excerpt from an older book (2002)
published by O'Reilly:
"Pregeneration and caching of content can be key to providing your site
visitors with a quality experience. With the right pregeneration and
caching, web pages pop up rather than drag, and loads are
reduced--sometimes dramatically--on the client, server, and network....
There's no need to dynamically regenerate content that doesn't change
between requests. "
<http://events.oreilly.com/pub/a/onjava/excerpt/jebp_3/index2.html>
Since this source is almost 8 years old, I thought I'd ask here. Is
"pregeneration" of content still considered a best practice? What tools
do you use to manage the process? The article recommends Tomcat & Ant,
apparently implying that you should build everything possible statically
with Ant before deploying it.
Any different thoughts?
There are no need to pregenerate static content.
Some pregeneration happens automatically in the Java world:
.class -> native
.jsp -> .java -> .class -> native
Data can and should be cached. Several cache products exists for
this purpose like EHCache.
If the context is CMS, then it is common to have the CMS
output something less dynamic from the source that is more
dynamic.
To speed up traditional dynamic stuff, then instead of
all types of ugly hacks, then simply put a cache server
like Varnish in front of your app server.
Arne