[development] Static Page Caching
Allie Micka
allie at pajunas.com
Thu Jan 12 14:22:37 UTC 2006
On Jan 10, 2006, at 11:57 AM, Boris Mann wrote:
>> Mike I am interested in seeing how Drupal could deliver static
>> pages through a cache mechanism like http://www.squid-cache.org/.
> AKA reverse proxy. This is well understood technology with regards
> to dynamic apps. Most of the configuration is done at the Squid
> level, which understands the appropriate Apache headers looking at
> when/if content has changes.
It's well worth roping squid into the discussion. Well-funded sites
with heavy load may have the resources to implement this, and it's
very effective for load-management overall: Squid's cached pages are
in memory/disk, and apache/php is never invoked when an object is
intercepted by the reverse proxy. You take the load off of the
apache server so it can focus on the rest of the dynamic tasks. This
lets you tune apache better, turning KeepAlive off, etc.
As configured, Drupal can't get much benefit from squid. It will
cache the css and image files, but all of the php content includes
headers that explicitly disable HTTP caching of any kind. This is
because the same resource is accessed by both anonymous and
registered users, so a single url can change radically. You might
try and get tricky with public/private headers, and get Drupal to NOT
start a session until the user is authenticated. But that's tricky.
The second problem with proxy caching is that there's no clean way to
expire content. It will live for as long as its Expires header
indicates. So a newly-published article will take a little while to
"kick in" on the cache server. Contrast that with the caching
strategies discussed here, where the static content can be
regenerated on the fly.
I'd love to see Drupal become more cacheable, but the anonymous/
authenticated thing is quite a challenge. But the solutions
discussed here can help: as long as the cached files are delivered
without non-caching headers, they can be intercepted by squid for
doubleplusgood caching performance.
Allie Micka
pajunas interactive, inc.
http://www.pajunas.com
scalable web hosting and open source strategies
More information about the development
mailing list