top | item 3335071

How To Optimize Your Site With HTTP Caching

85 points| zerop | 14 years ago |betterexplained.com | reply

29 comments

order
[+] bitops|14 years ago|reply
This is a good writeup, though I'm surprised no-one has mentioned the holy grail of caching with HTTP. That of course is good old RFC 2616: http://www.ietf.org/rfc/rfc2616.txt

There's an entire section in there devoted just to caching in HTTP. Very well worth reading in its entirety.

[+] ceol|14 years ago|reply
This is a great article for an introduction to HTTP caching. It's well-written and even covers how to set up caching in Apache.
[+] kalid|14 years ago|reply
Thanks for the kind words (I'm the author). My main, ever-evolving goal when writing tutorials is to try to write what I'd like to see:

1) Explain the underlying concept

2) Show variations

3) Explain how to do it yourself

4) Show how to verify you did it correctly

5) Meta: be as concise as possible, maximize bang for the buck

[+] fexl|14 years ago|reply
And it links to another great article on gzip compression.
[+] js4all|14 years ago|reply
A pretty basic write up. Static caching is standard these days. The article doesn't help with speeding up today's dynamic sites.
[+] ehc|14 years ago|reply
Article from 2007
[+] kalid|14 years ago|reply
Yep, I was surprised too to see it on HN :).

I think one of the meta-takeaway is that understanding the fundamentals of web caching can help with your general CS knowledge ("There are only two hard problems in Computer Science: cache invalidation and naming things." -- Phil Karlton).

Looking at Apache, we see a few strategies:

  * Include last-modified metadata
  * Include content metadata (eTag/md5 of content)
  * Include explicit expiration date
  * Include a max-age
  * Include metadata about who can cache (public/private/no-caching, i.e. users can cache but proxies cannot)
These approaches could be used when designing data flows with Memcache, Redis, etc.
[+] bittermang|14 years ago|reply
Good information doesn't necessarily have an expiration date, but I concede to your point that it might not be the most up to date source out there.
[+] oniTony|14 years ago|reply
2008+ version -- throw your assets into CloudFront (or another CDN of choice), let CDN handle the caching. ;)