
“The Spike of Death”
When I saw an article about “caching” in a Wordpress blog, I quickly turned my face away. I’ve had bad experiences with caching ever since I became a rich internet application developer. It creates headaches and out of date data when it’s not used correctly.
Until last week, I got an email from my hosting company, Lunarpages, telling me that my account was moved to a temporary server because it was hogging the shared server. I was shocked! It turned out that my post about Battlefield Heroes, had invited about 15,000 visitors in a 2 day span (stumbled first by ksc7)!
In a panic state, I finally researched on caching and found out about WP-SuperCache Plug-in for Wordpress.
This blog usually gets around 300-400 visitors a day. So a sudden spike of around 7000 visitors a day is totally unexpected.
Let’s try to analyze what usually happens when a reader comes to visit your blog (this is not an accurate one but simple to understand) :
- Someone comes to a page on your blog (from search engines, blog community, links from other sites, or directly, it doesn’t matter)
- The Wordpress System will execute a bunch of PHP codes to display your content. This process includes getting your article that you have written out from the database, grabbing the theme files that you use, retrieving any comments of the post, execute all installed & activated plug-ins, and other bits and pieces.
- The actual page will then be generated and displayed on-the-fly, dynamically.
That’s roughly how it goes. This method saves a lot of space and remove a lot of dependencies, as the Wordpress system only needs to store your post contents on the database. Any changes on your theme will not affect the posts. It’s brilliant. This whole process happens in some split seconds, so you/your readers won’t notice a thing.
However, can you imagine having thousands of people executing these processes at the same time? This was what happened. All of a sudden, you have these thousands of PHP codes need to be served and executed to these readers at the same time. It will take some resources out from the server where your blog is hosted at. So what should we do?
Solution: Caching (or triple the server’s resources, but to what end?)
Caching in a Wordpress blog works by generating a static HTML page out of your posts. So instead of generating the page on-the-fly on every page hit, the system will serve a pre-made HTML file to the user. This saves tremendous calls to the database and PHP scripts execution. The page does not need to be “created” on every single page hit anymore.
WP-SuperCache plug-in will take care all of these for you. How it works basically:
- Someone comes to a page on your blog
- The plug-in will check whether the post has been cached before. If not, it will generate the page dynamically as usual and present it to the user.
- HOWEVER, this generated page will then be saved to the server as a single HTML file.
- Another person comes to the same page.
- The plug-in checks that the post has been cached before, and therefore presents the cache (a static HTML file), saving lots of resources and time!
You can check whether you are being served a cache or not by viewing the source of the page. For example, you can view the source of this post, and at the bottom of the page, if you see one of these lines:
<!– Cached page served by WP-Cache –> or <!– super cache –>
that means you are being served the cache of the post :) If you have commented on my posts before, chances are that you will never see cached pages (Why? Read the documentation on the plug-in page :))
To prevent an out-of-date information (which I hate the most about caching), the plug-in will refresh the cache whenever someone posts comments or whenever a cache time out has been reached (configurable). Again, have a read on the plug-in documentation to find out more on this.
The most annoying part is probably when you are making changes on your theme files, you have to delete the cache to see the change. So make sure you have at least reached to a state where you’re happy with your current layout before installing this plug-in.
Conclusion
I’m positive that every blog needs to have a caching mechanism installed. If you haven’t got it yet, you really have to think it over. My hosting is very nice to me as they were patient in working out with me as to why this happened and waited for me to fix it up. My friends said that most of the hosting account have probably suspended your account until the issue is rectified.
So, the question is, when you’ve got a sudden boost of traffic from StumbleUpon or Digg, how ready is your blog?
But again, even if you have installed caching, there are limits that you can reach before you have to move to a dedicated hosting server with more horsepower and bandwith!

|
If you are a blogger and like this blogging tip, make sure that you subscribe to my Blogging category feed to always get my latest blogging guides and tips.
Stay updated and get my latest posts delivered to you by subscribing to my main feed via email or your favorite feed reader. If you are a blogger, feel free to leave a trackback to this post.










Glad the cache worked well for you! For some reason I only see the regular WP Cache sig at the end of this page’s source, not the WP Super Cache one. (and this is before leaving the comment!)
Donncha O Caoimh’s last blog post..How to Insult the Mac Brigade
Lunarpages must be a good host. I have had some that wouldn’t go that far and treat you like an ass. I have had sites shut down, etc. I do have one dedicated server and a shared account for low traffic site.
I tried a caching plugin for Wordpress a few years ago. It would work everywhere except Dreamhost. On the Dreamhost sites, you got a blank page and had to refresh to get the page. Not sure what caused that, but I guess it’s about time I try a caching plugin again.
Stephan Miller’s last blog post..A Bunch of Random Links
@Donncha: It seems that I’ve fixed the htaccess and ’supercache’ should be seen if you’ve never commented on my blog before (pure HTML file delivered). Thanks for trying to sort it out with me on the emails
@Stephan: Yea it’s a very good hosting. This problem has been going on for a week and even now, they are still patient to wait until I fix the issue.
Just to let you all know, some of your plug-ins may not work properly. An example is my post views. Since it’s in PHP, counters are not updated correctly due to caching to HTML (It’s showing 42 views whereas I should have got around 300 page views according to Google Analytics).
Someone has made a Javascript version of it, but I couldn’t manage to get it to work
I have been considering this, I will be bookmarking this for later thanks for the tips.
Josh’s last blog post..Triple your traffic, I promise
One gripe that I have with them caching plugins is that the comments do not show up straight away.
No way to fix this problem aye?
Deimos Tel`Arin’s last blog post..Mortal Kombat vs Street Fighter - Ryu vs Sub-Zero
Well, you can change the settings when the cache will refresh, if you want.
The default is every hour if you have left a comment before (WP-Cache)
and Every 6 hours if you never leave any comments on my blog before (Supercache)
I guess even resetting the cache every half an hour is still far better than having no cache at all (in a condition where you get a constant hundreds of traffics per hour!)
There’s always a trade off, unfortunately
(hence why I “turned” my face away when I first read a glimpse about caching)
Deimos - even with a caching plugin your comments should appear immediately unless the blog author has “locked down” his site, or has moderation, or his theme is broken.
Donncha O Caoimh’s last blog post..How to Insult the Mac Brigade
Oh sorry, Donncha. So the post’ cache is refreshed everytime someone leaves a new comment? I should have read the documentation more thoroughly ^^
@Donncha O Caoimh:
Well, I find it that I still need to hit the “refresh” button in order for me comment to show up. :p
That’s a little thumb down for me.
Deimos Tel`Arin’s last blog post..Mortal Kombat vs Street Fighter - Ryu vs Sub-Zero
Very useful and informative post Michael!
T
Tommy’s last blog post..Firefox Launches 4th Beta
I used WP-Cache ever since. I just didn’t checked if it worked. But it does says in my dashboard how many pages are cached. And based on my observation, I agree with Donncha, it should display your comments right away even if the page is cached. Seems you got yourself one nice problem, Michael. Totally awesome - 7000 visitors.
bloggista’s last blog post..Free Ultimate Web Site Promotion Tool: Get 1M hits to your blog or website
This post is a very good summary of how it works and why it is smart to be ready. The problem with the plugin is the installation process. It is not for the tech challenged at all or even for someone like me that is middle of the road when it comes to this stuff.
I looked at installing wp-supercache a few months ago. I absolutely could not figure it out. I tried to get answers from the comments at the plugin page, but everyone there is a super geek and I could not follow the solutions that were offered.
I have a very tech savvy friend that installed it on his site. He is very happy now that it is working, but even he said it was the single most difficult install of anything he has done on his web site. It took him almost all day to get it working correctly. Most of the time his site was offline as he was doing it. I concluded it was hopeless for the average WordPress user.
The concept and how it works is great. Maybe I will take another look at it and see if I am brave enough now to try installing. Or maybe I will try it on a test blog first so I don’t kill my site as I attempt to figure it out.
Will’s last blog post..Review: Live in the Balance by Linda Prout, M.S.
Hi Will,
It’s probably because of the old version. When I installed this, it was as easy as installing other plug-ins (Activate the plug-in, Go to the plug-in options, and turn the caching on).
I did stumble a problem however, and that was why you need to know some computer/tech skills to “fix” it up. Donncha, the author of the plug-in however, has fixed it in the new version, so it should be ok to install this plug-in.
You do have to sacrifice a few other plug-ins if you install caching, however (those that relies on PHP scripting if you use caching). Whether the trade off is worth it, it’s for you to decide
Thanks Michael - How do you know which plugins rely on php scripting? Is there a way to tell? Or is there a list somewhere? It would be good to know before hand which plugins do not work with so we can decide if the caching is worth it. Thanks!
btw: I looked at the wp-supercache forum at WP support. LOL-Scary, should not have done that!
Will’s last blog post..Review: Live in the Balance by Linda Prout, M.S.
Unfortunately there’s not a list that you can look at to find out what will work and what will not…
Since the caching will deliver pure HTML file to your readers (no dynamic content), all plug-ins that are processed dynamically on every page read with PHP scripts, for example, will not work well.
I’ve heard that Wordpress is planning to implement caching on its future release. Hopefully WP-SuperCache’s author, Donncha, can somehow work with them and produce the ultimate solution!
Thanks! It wold be great if WordPress 5 did this.
Will’s last blog post..Do Warnings of Contaminated Water Arrive in Time?
[...] Why caching is important for your blog (Michaelaulia.com) [...]
thats great to hear. I have used wp-super-cache for a while now and I’m very happy with it. Even though we host where it shouldn’t be a problem to randomly go from 300 hits/day to 7000/day - its still nice to have the added comfort of the reduced database load.
Matt Ellsworth’s last blog post..Widemile Goes Into Beta, Picks Up 13 Partners
You have just won a free Banner on Blogsvine.com for this post. Have a great day
Nk’s last blog post..Had The Blogs Taken The Web?
[...] Why caching is important for your blog | Michael Aulia’s Blog [...]
[...] Why caching is important for your blog | Michael Aulia’s Blog [...]
[...] Why caching is important for your blog | Michael Aulia’s Blog [...]
I look forward to, yet fear the day when I get on the digg frontpage. My 100$/year shared hosting server will just go bananas!
I’ll just stick to the stumbleupon traffic for now.
The fact you’re hosting company is complaining must be a good sign. It means you’re getting more visitors and thats all we really want, don’t we? =)
Nicos last blog post..How to Learn a Healthy Lifestyle: Think for Yourself!
my blog is basically low traffic and running on a VPS along with a few more websites. Started using Supercache a few days ago to keep PHP and MySQL from taking on too much memory.
Works great! Thanks for the great article
archondigitals last blog post..Saying Goodbye to the Grid
@Nico: I don’t think I’ll ever get to the Digg’s front page. Even struggling to get more than 5 Dugg
I don’t understand how people do it. They must have a group of friends/bloggers collaborating!
@archondhigital: Good you can make it work! You’ll never know when you are going to get a spike of traffic!
The day my host complains about me having too much traffic, I’ll do a dance for them.
And maybe I should install the cache plugin as well…
In designing my blogging software I took the approach in writing flat HTML files from the start. The downside is a flat layout requires considerably more space. There is always a trade off between speed and space. For me, speed is more important.
Mar Matthias Darins last blog post..9-11 Conspiracy
True. However, space is no longer limited these days.. my hosting gives me about 1.5 TB of Space.. now what would I use that for?? (Unless if I’m hosting video files or a warez site)
Michael thanks for sharing about caching. I highly recommend it for any site, even if you don’t think you’ll get the Digg or SU effect. Good to have.
Hi,
I was recommended by Lunarpages to this blog post of yours, no wonder why
But my experience has been real bad with them. Even after installing super cache and trying my level best to resolve the issue, they suspended my account and expected me to solve it. Without accessing my admin page how am i supposed to resolve the issue I dont know.
Anyway, some sane soul out there has unsuspended my account and I have made many changes including what you have suggested, hopefully my website don’t go down again.
@Arnold: Well you’ll never know when you are going to get a Digg or SU effect!
@Raju: Sorry to hear that you had a bit of problem with them. I was transferred to another server last time and they’ve been very helpful to me. You probably got a wrong support guy at the wrong time
Sometimes I’ve been getting 8000-10,000 traffic a day these few weeks and LunarPages didn’t send me any warnings, so I think supercache really works! Or they didn’t notice the spike O_o