Performancing Metrics

To Cache or Not to Cache?

If you’re running your blog from a hosted platform, such as wordpress.com, Typepad or Blogger, you probably don’t have to worry about database (and/or PHP) servers choking and bandwidth running out. For folks who run blogs on their own hosting accounts or servers, this is a possibility. Yet then again, for the average blogger bandwidth and server resources shouldn’t be an issue. Even the most inexpensive hosting account on most providers these days can give enough for most folks (some hosting providers I can point to are our very own Colorteck and one of our sponsors, Cirtex).

This only becomes a big concern when you become really popular or when you get rare DIGG or Slashdot-effect traffic spikes. Or perhaps your server is a bit low on resources, and is serving up your site slowly. To address these, you can use caching plugins. We have been using several caching plugins on some of our bigger blogs like the Blog Herald and Forever Geek. Not only are traffic levels there consistently high, sometimes we also get frontpaged on DIGG, Slashdot, Stumbleupon and other social bookmarkers.

WP-Cache is one good plugin. Another one is WP-Super Cache, which is actually built upon WP-Cache.

We’ve recently switched to the latter, and so far we’re satisfied.

How caching plugins work

Basically, caching works by generating static files on your server, such that database requests are no longer required. This lightens the load on your database server, and makes loading faster, too.

According to the WP-Cache profile:

It works by caching Worpress pages and storing them in a static file for serving future requests directly from the file rather than loading and compiling the whole PHP code and then building the page from the database. WP-Cache allows to serve hundred of times more pages per second, and to reduce the response time from several tenths of seconds to less than a millisecond.

And WP-Super Cache improves on this:

[WP-Cache 2 still uses] the PHP engine to serve the cached files.

WP Super Cache gets around that. When it is installed, html files are generated and they are served without ever invoking a single line of PHP. How fast can your site serve graphic files? That’s (almost) as fast it will be able to serve these cached files. If your site is struggling to cope with the daily number of visitors, or if your site appears on Digg.com, Slashdot or any other popular site then this plugin is for you.

Pros and Cons

Great! So caching plugins help make my site load faster AND it takes the heavy load off the server by minimizing PHP execution and database queries. However, one big disadvantage of caching is that essentially your site will be static, and any dynamic elements might not work.

Sure, everytime you publish a new post, the cache is refreshed. And everytime someone posts a comment, the cache for that particular post is refreshed. At least it’s supposed to be that way. But how about those instances when you need rotating content or images. For instance, some themes use rotating headers. And sometimes, like with several blogs in the Splashpress Network, we use rotating ads (links or images that share the same spot, supposedly alternating). Another issue is when you pull feeds from external sites, like we do. See those three boxes at the rightmost sidebar? Those are feeds pulled from some of our blogging resources.

I’m not sure if caching plugins support this, but I’m assuming they don’t, since the premise with caching is that static files are served until (1) they expire; (2) they are refreshed with new posts or comments or (3) they are manually reset.

For most folks, this is not an issue. And perhaps we can resort to measures that can help resolve these. But what I’m looking for is a plugin wherein you can define which areas of your blog to cache and which not to. Hopefully that won’t be too complicated.

Categories: Blogger Tools, WordPress Plugins

This post was written by . You can visit the for a short bio, more posts, and other information about the author.


Comment with Your Facebook Account

Comments

  1. Donncha O Caoimh says: 5/7/2008

    Just use Javascript for the dynamic parts of your page. That’s the easiest (and oldest) way of including dynamic content in a page.

    Reply

  2. redwall_hp ) says: 5/7/2008

    I get a descent amount of traffic, a lot of which is from StumbleUpon, and I’m running on a shared host. I use WP Super Cache to maximize my mileage transfer-wise.

    My advice, for cache uses who need to have some dynamic content, like a banner rotator, hack your banner script to output JavaScript so you can still use it through the cache. It’s a bit of a pain to setup, and takes some l337 PHP skills, but it works fairly well.

    Reply

  3. DMZ says: 5/8/2008


    I’m not sure if caching plugins support this, but I’m assuming they don’t, since the premise with caching is that static files are served until (1) they expire; (2) they are refreshed with new posts or comments or (3) they are manually reset.

    This is going to sound a little negative, but –

    Really? You wrote that whole post but couldn’t be bothered to take the extra minute or two to read the documentation on this and come up with an answer better than “I assume they don’t?”

    Come on.

    I have to admit I unsubscribed from the RSS feed after reading this one.

    Reply

  4. web tasarım says: 5/8/2008

    Thanks for the article..

    Reply

  5. ameo says: 5/9/2008

    i thought about it actually sometimes but never went for it .
    i’ll try it now and see what happens . thanks

    Reply

  6. J. Angelo Racoma says: 5/9/2008

    DMZ, I don’t know if I intended it that way or not, but I did refer to any caching plugin in particular. I just stated that I wasn’t sure if caching plugins _in general_ did this.

    And if you need a specific answer, no – WP Super Cache doesn’t support this, unless you use JavaScript to load those dynamic aspects of your site. I read the documentation.

    Cheers,

    angelo

    Reply

  7. Ajay ) says: 5/18/2008

    One problem (or feature??) is the amount of space my cache took. I had to increase the disk storage of my account to accommodate for the cache.

    I guess it is great at times when the traffic hits a major high, however for regular traffic it isn’t going to give you too much of a saving.

    Reply

  8. youtube says: 5/26/2008

    Great! So caching plugins help make my site load faster AND it takes the heavy load off the server by minimizing PHP execution and database queries. However, one big disadvantage of caching is that essentially your site will be static, and any dynamic elements might not work.

    Reply

  9. turkrap says: 7/2/2008

    This is going to sound a little negative

    Reply

  10. Alan says: 8/13/2008

    What is the best thing to do for this PHP code
    cache = [true or false] – Cache the rss feed for faster load

    Reply

  11. rap says: 9/21/2008

    Great! So caching plugins help make my site load faster AND it takes the heavy load off the server by minimizing PHP execution and database queries. However, one big disadvantage of caching is that essentially your site will be static, and any dynamic elements might not work.

    Reply

  12. programlar says: 9/22/2008

    Great! So caching plugins help make my site load faster AND it takes the heavy load off the server by minimizing PHP execution and database queries. However, one big disadvantage of caching is that essentially your site will be static, and any dynamic elements might not work.

    Reply

  13. program says: 9/22/2008

    However, one big disadvantage of caching is that essentially your site will be static, and any dynamic elements might not work.

    Reply

  14. Rap says: 12/26/2008

    i’ll try it now and see what happens . thanks.

    Reply

  15. ibrahim says: 1/17/2009

    ok mn thnku;)

    Reply

  16. Bakire says: 1/17/2009

    its great article thank you

    Reply

  17. araba oyunları says: 1/18/2009

    if folks want to ‘test it out’ please feel free to hit my site, though only if you’re gonna leave real comments! don’t try ‘manual spam’ to disprove it (what i mean is that you can see a real comment float through just fine, contrary to what others above are saying)

    Reply

  18. futbol oyunları says: 1/18/2009

    if folks want to ‘test it out’ please feel free to hit my site, though only if you’re gonna leave real comments! don’t try ‘manual spam’ to disprove it (what i mean is that saying)

    Reply

  19. motor oyunları says: 1/18/2009

    ase feel free to hit my site, though only if you’re gonna leave real comments! don’t try ‘manual spam’ to disprove it (what i mean is that you can see a real comment float through just fine, contrary to what others above are saying)

    Reply

  20. savaş oyunları says: 1/18/2009

    y ‘manual spam’ to disprove it (what i mean is that you can see a real comment float through just fine, contrary to what others above are saying)

    Reply

  21. yemek oyunları says: 1/18/2009

    if folks want to ‘test it out’ you’re gonna leave real comments! don’t try ‘manual spam’ to disprove it contrary to what others above are saying)

    Reply

  22. 3d oyunlar says: 1/18/2009

    mments! don’t try ‘manual spam’ to disprove it (what i mean is that you can see a reing)

    Reply

  23. avatar oyunlar says: 1/18/2009

    real comment float through just fine, contrary to what others above are

    Reply

  24. Greenman says: 1/18/2009

    very thanks

    Reply

  25. resimli yemek Tarifleri says: 1/18/2009

    real comment float through just fine

    Reply

  26. chat says: 1/18/2009

    Global chat sites

    Reply

  27. ekz says: 1/22/2009

    Thank you.

    Reply

  28. zrmbilisim katkıları ile 2009 seo yarışması says: 3/7/2009

    globah hot

    Reply

  29. kredi says: 3/9/2009

    thanks
    kredi

    Reply

  30. singlesoul says: 3/9/2009

    thanks for everything yo do.

    Reply

  31. chat odalari says: 3/12/2009

    thanks admin..

    Reply

  32. antiforum says: 3/13/2009

    thanks admin

    Reply

  33. korkma says: 3/13/2009

    usullay

    Reply

  34. papatya chat says: 3/22/2009

    thanks for everything yo do.

    Reply

  35. Futbol Argentina says: 4/9/2009

    Muy buen blog. No veo la hora de que llegue el mundial de futbol en sudafrica 2010

    Reply

  36. Bakimli Kadin says: 4/14/2009

    thanks for article.it’s great article for me.

    Reply

  37. dersler says: 6/13/2009

    thanss vey good.

    Reply

  38. Futbol Oyunları Maç Oyunları says: 6/20/2009

    Thanks admin. Very nice and cool. Super…

    Reply

  39. Savaş Oyunları Erkek Oyunları says: 6/20/2009

    Thanks admin. Very nice and cool.

    Reply

  40. Korku Oyunları Korkunç Oyunlar says: 6/20/2009

    Super…

    Reply

  41. Kız Oyunu says: 6/20/2009

    Thanks admin. Very nice and cool. Super site…

    Reply

  42. Yarış Oyunları says: 6/20/2009

    Thanks admin. Very nice and cool. Super…Good job.

    Reply

  43. Ev Oyunları says: 6/20/2009

    Thanks admin. Very nice and cool. Good job…

    Reply

  44. Barbie Oyunu says: 6/20/2009

    Thanks admin. Very nice…Good job…

    Reply

  45. macera oyunlari says: 7/14/2009

    tekekürler.. güzel çalışma

    Reply

  46. veri kurtarma says: 7/24/2009

    veri kurtarma, data veri kurtarma, veri kurtarma indir, kurtarma
    programı, veri kurtarma programı, disk kurtarma, disk veri kurtarma, veri kurtarma full, data
    recovery, veri kurtarma format, silinen veri kurtarma, hdd veri kurtarma, silinen dosyaları
    kurtarma, data kurtarma, veri nedir

    Reply

  47. Fore Kazık, Kazık Makinası BEKSAL ZEMİN says: 7/24/2009

    Fore Kazık, Kazık Makinası, BEKSAL ZEMİN, Sağlıklı yapılar için Fore Kazıklama sitemleri şarttır.

    Reply

  48. online oyun says: 7/29/2009

    Thanks for posting about this, I would like to read more about this topic.

    Reply

  49. oyunlar says: 7/29/2009

    thabks nice share

    Reply

  50. www.seslichatodasi.com says: 9/2/2009

    1 Number of chat sites expect you all http://www.seslichatodasi.com Thanks

    Reply

  51. V-Pills says: 9/6/2009

    thabks nice share

    Reply

  52. sizeders says: 9/8/2009

    Thank you this is really nice share

    Reply

  53. mikeyaozm says: 9/20/2009

    Basically, caching works by generating static files on your server,

    Reply

  54. Wafflecm says: 9/24/2009

    thank you admin nice post

    Reply

  55. haggle ) says: 6/6/2010

    Thank you for this information is very useful to me

    Reply

  56. hasan says: 10/26/2010

    thanks

    very nice

    Reply

  57. Birol6621 ) says: 10/31/2010

    thanks

    very nice

    Reply

  58. liselim ) says: 11/9/2010

    liseli liseli kizlar

    Reply

  59. techlunatic says: 12/21/2010

    So adsense will not work if catching is enabled?

    Reply

  60. Kadir says: 12/24/2010

    Thansk for post… Very nice.

    Reply

  61. y8 says: 5/26/2011

    thanks

    very nice

    Reply

  62. y8 says: 6/10/2011

    Looks great, I’ll try it on my site. Thanks

    Reply

  63. kız oyun says: 11/12/2011

    thanks for article,great job, thanks from turkey

    Reply

  64. araba yarışı says: 11/21/2011

    very good post thanks

    Reply

  65. motor oyunları says: 11/21/2011

    thanks very nice

    Reply

  66. yemek oyunları says: 11/21/2011

    Thansk for post… Very nice.

    Reply

  67. caillou oyunlar? says: 1/13/2012

    Very nice thank you post

    Reply

  68. yumurcak oyunlar? says: 1/21/2012

    thanks admin good site

    Reply

  69. invest liberty reserve says: 2/28/2012

    To Cache or Not to Cache? | BloggingPro I was recommended this blog by my cousin. I am not sure whether this post is written by him as no one else know such detailed about my difficulty. You are wonderful! Thanks! your article about To Cache or Not to Cache? | BloggingPro Best Regards Lisa Justin

    Reply

  70. hakan y?ld?z says: 5/22/2012

    thnks for u

    Reply

  71. kurban says: 11/2/2012

    thanks for the art?chal

    Reply

  72. sanalzade says: 12/17/2012

    thanks for article.it’s great article for me..

    Reply

  73. Abdil ) says: 3/22/2013

    Thanks for the hints.

    Reply

  74. Oscar Papp says: 11/14/2013

    Wow, wonderful blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your site is wonderful, let alone the content!. Thanks For Your article about To Cache or Not to Cache? | BloggingPro .

    Reply