memcached: Need for Speed



Over the past month, we’ve been working with a client to migrate some very large sites from their old hosting provider to us, and in the process, have slowly been gaining an appreciation for what is involved in optimizing a web site for performance … especially when it comes to WordPress.Wordpress, for those that aren’t aware, is a blogging package built on top of the MySQL DB, and as good as the front end is, the backend can be painful, and in some cases, downright nightmarish. Don’t get my wrong, considering the amount of developers and plugin’s that go into a complex site, it is totally understandable, but it really means you should be looking at all of the performance optimizations that you can throw at it.

One of the biggest, and easiest, optimizations that you can enable for WordPress is a plugin called ‘memcached’. Drupal has an equivalent module for this, so it isn’t something restricted to just WordPress.

What memcached does is provides a memory cache of data pulled from the database server, so that commonly pulled data (ie. your home page, a popular article) is quickly accessed from memory, instead of having to go to the database server, doing a search for the data, and pulling it out.

For those of you without any computer background, the biggest bottleneck in any system is generally reading data from the hard drives, while reading from memory is generally the fastest. So the more you can cache (or store) in memory, the better, and faster, your sites perform.

Enabling this plugin requires three things (whether for WordPress, or Drupal):

  • memcached daemon
  • pecl-memcache (for PHP)
  • memcached plugin / module (see below for URLs)

Now, there are three systems being run on our servers that I know can make use of memcached:

  1.  Semiologic, through sem-cache
  2. WordPress, using:
  3. Drupal (6 & 7), using:

For those sites that we have helped to get this configured on, it makes a very noticeable difference in page load times, so it is definitely worth your time to make sure it is running on your sites.

Since I know *most* sites don’t have this running / configured, for those that want to review and make sure, the first step is to make sure that the memcached daemon and php module are both available. Just post a ticket to AMS, and we’ll make sure they are in place.

For those that aren’t using either WordPress or Drupal, but are aware of similar modules / plugins for those applications they are using, we would appreciate it if you could take a moment to login to post something to, let us know what you are running, and provide a bit of a description on what is involved in getting memcached installed and configured.