Chapter 13. Caching

Static Web sites, in which simple files are served directly to the Web, scale like crazy. But a fundamental tradeoff in dynamic Web sites is, well, they're dynamic. Each time a user requests a page, the Web server makes all sorts of calculationsfrom database queries, to template rendering, to business logicto create the page that your site's visitor sees. From a processing-overhead perspective, this is quite expensive.

For most Web applications, this overhead isn't a big deal. Most Web applications aren't or Slashdot; they're small- to medium-sized sites with so-so traffic. But for medium- to high-traffic sites, it's essential to cut as much overhead as possible. That's where caching comes in.

To cache something ...

Get The Definitive Guide to Django: Web Development Done Right now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.