Tuesday, April 14, 2009

DB Cache or Super Caches which is which

Most bloggers are familiar with WP SuperCache, a WordPress plugin that dynamically caches WP by converting them into static pages, thereby avoiding repeated database queries. While it’s very effective, this approach though has had several drawbacks. Then, there’s the newer one called WP DB Cache.
Let me break down some of the advantages and dis-advantages of WP-SuperCache and DB-Cache so you can see which of the two plugins is better for your blog.

WP SuperCache
Creates static version of each cached pages so it can easily eat up a lot of web space though that will depend how many pages your blog has (remember that tags, archives, and paged comments are also separate pages). I’ve seen WP-SuperCache easily eat up 300+MB of webspace for larger blogs.
Very effective for blogs that experience high surge in traffic for a single page (like being Dugg, SlashDot or Stumbled Upon) as the target page is automatically cached for a given period of time. That page basically serves static HTML sparing all database queries (unless of course visitors on that page comment a lot).
Additional features like Lock Down adds a layer of protection for high-trafficked pages that keeps on getting updated by visitor comments. This feature delays the display of new comments so it can just serve a single static page for that period.
Has some page delivery problems when enabled with WP-Mobile. The mobile version of the blog homepage is sometimes cached and served as the static page.
Leaves some stale pages. The cache does not refresh unless content on a page is edited. That leaves the Sidebar stale when new contents are added to it.

WP DB Cache
Caches DB queries instead of entirely making the page static. Reduces the number of DB queries on all pages but not all.
Does not save individual pages as static files so it doesn’t use a lot of web space for caching.
Might not be able to handle a sudden surge of traffic on a single page (in case of Digg or Slashdot flood).
Blog elements stay fresh (sidebar, widgets, etc.)
Effective for blogs that have hundreds or thousands of actively viewed pages.
I think the main difference between WP SuperCache and WP DB Cache is that the latter’s caches are re-used on all pages of the blog while WP-SuperCache only serves cache on a per page basis.
Best caching benefit for WP DB Cache: 1,000 pages of a blog are visited just once but all at the same time.
Best caching benefit for WP SuperCache: 1,000 visitors view a single page of a blog all at the same time.
Depending on which of the two scenarios best fit your blog, you can choose between the two caching plugins.

No comments:

Post a Comment