Photograph of woman in yoga post

A growing audience places greater demands on site performance: 20 casual visitors a day is a very different animal from thousands of people hitting your site every hour. There are many possible ways to adapt to the demands of increased traffic:

  • Optimising and compressing site resources: most especially images, but also HTML, CSS and JavaScript.
  • Writing more efficient database queries.
  • Caching site resources.
  • Utilizing a Content Delivery Network.
  • Upgrading hosting services and servers.

The first three are usually the cheapest options, yielding the greatest bang for your buck, although they can make some time and work to apply. The last two options are usually fast to apply and very effective, but come with long-term expense in the form of increased monthly fees from your hosting provider and CDN.

Caching is complicated by the fact that there are at least three different ways the content of your site can be cached:

  • Local caching, whereby the browser stores information downloaded from a site locally, and refers to it during subsequent visits rather than reloading the original data stored on the server. All browsers do this naturally to some degree, some more aggressively than others. You can control local caching behavior for every browser, directing what is stored and for how long, to further benefit for your site.
  • Server-side caching, in which a static copy is made of a dynamic page. This copy is served to the user, rather than assembling a fresh page for every visitor.
  • Caching on a CDN, where copies of site resources are distributed across servers to achieve faster delivery times in response to requests.

As CDN caching techniques differ slightly from one Content Delivery Network to another, I’ll concentrate on just the first two variations in the series to come.

Caching can deliver significant speed benefits to a site, but comes with a cost: once published, it is assumed that site assets will very rarely change, or not at all. Maintaining a site under such conditions can be a trying experience: you are literally fighting the memory of the site, a memory potentially stored in at least three different locations. For this reason, I'll address “cache-busting” techniques at the end of this series, detailing ways of alerting local and server-side caches that new content is available and should be reflected in the browser, rather than drawing the old version from the cache.

Banner image by Vi Khoa Duong, licensed under Creative Commons

Enjoy this piece? I invite you to follow me at to learn more.