Re: [squid-users] Squid vs caching products like memcached

From: Adrian Chadd <adrian@dont-contact.us>
Date: Thu, 17 May 2007 08:18:53 +0800

On Wed, May 16, 2007, lightbulb432 wrote:
>
> Great answer, thanks!
>
> How does Squid's page caching ability work in terms of caching pages (as
> though they are static) but that were generated dynamically?
>
> For example, Amazon.com's homepage is dynamic but not generated dynamically
> on each request for that page; rather, I assume they set it to be cached
> anytime a request for that page comes in, with some sort of expiration
> policy (e.g. only dynamically generate the homepage once an hour, then serve
> that cached static page for the rest of that hour).
>
> I really hope Squid makes such a configuration possible and easy.

You'd probably be surprised - sites seem happy to assemble their PHP pages
almost every time, and try to use various constructs to cache the data used
to create the page (RSS, XML, SQL, etc.)

Dynamic content page authors need to assemble some behaviours which
are cache-friendly. Its not impossible, it just requires a little smart
thinking whilst designing stuff.

The Squid homepage at the moment is assembled via PHP, but it:

* Assemble a last-modified header based on the datestamp of the "bits" of the
  page (it takes the most recent time of each of the elements and uses that
  as LM - including the page content, the header/footer, and the generation script.)
* Generates an E-Tag based on the above Last-Modified header
* Handle If-Modified-Since

I'm sure there's more that can be done - I'll be looking into what else can be
done if/when I dynamically pull in RSS for a "news" section, for example -
but you have to keep in mind you're trying to improve user experience.

Most sites seem to concentrate on improving user experience through larger
pipes to the internet and employing CDNs. (There's some "game" to being able
to say you push large amounts of traffic, it seems to pull funding.)
You can also improve user experience by ensuring the relevant bits of your
page are cachable with the right options - and even if that requires
revalidation (a couple RTTs for the TCP setup, then request/reply), you're
still saving on the object transfer time.

Adrian
Received on Wed May 16 2007 - 18:18:39 MDT

This archive was generated by hypermail pre-2.1.9 : Fri Jun 01 2007 - 12:00:05 MDT