[wp-hackers] Useful caching

Matt Mullenweg m at mullenweg.com
Sun Sep 24 11:05:42 GMT 2006

On most WP blogs I've seen, there are two pages that get far and away 
the most traffic: the front page and the RSS feed. Ofter it's 5-10x the 
amount of traffic of anything else on the site, so it makes sense to 
focus some attention there.

After the built-in object cache has kicked in, there are really only a 
few queries left on the front page, sometimes as few as 5. Here's the 
queries that are left:

1. Get * wp_posts front page posts.
2. Get the categories of those posts.
3. Get the postmeta for those posts.
4. Get all pages for the menu.
5. Get the total number of pubished posts to decide whether to page.

(These combined took 55 milliseconds, 53 of which was 4 and 5.)

Of these, 4 & 5 are discretely cacheable.

1-3 seems like they could be put into a big $posts object and saved in a 
special case front page cache that's used for the front page and the 
regular RSS feed.

To go a step further, the root RSS feed would be a good candidate for 
wp-cache style output buffer caching, since we don't have to worry about 
things on that page that aren't controled by WP. (And we already send 
the correct caching HTTP headers.)

Matt Mullenweg
  http://photomatt.net | http://wordpress.org
http://automattic.com | http://akismet.com

More information about the wp-hackers mailing list