ShovelsSo, having dealt with the repercussions of the Digg (Slashdot) Effect, I thought I would share some of the lessons that I have learned over the past few days. These have been hard lessons to learn. And, in hindsight, some of these lessons should have been obvious. I just hope that someone will be able to learn from my mistakes so that you can be prepared for it when it happens to you.

Lesson 1: You Web Host Will Help You…

I would have been completely sunk had my web host not been willing to communicate and work with me so that I could get back to business as usual ASAP. They were very professional and helpful.

As soon as you realize that your hits are jumping or you believe that the Digg Effect is coming, notify your web host immediately. They can sometimes redirect extra resources to the issue and help keep things running smoothly. And keep them posted as to the status of the situation.

Lesson 2: …But Your Web Host Is In This To Ultimately Make Money

My web host was very quick to offer me a dedicated hosting solution at 48x what I was paying! Because I was consuming an unusually large amount of bandwidth, they throttled by bandwidth back (even though I had only used 1% of my 2512 GB allotment and even now I have only used 4%).

What surprised me was that even on my most bandwidth intensive day (Thursday), I used 68,326.44 MB of bandwidth. Even if I had continued at this usage rate (that I was told was too high) for the entire month of January, my usage would have only hit 2069 GB. That is only 83% of my allotted amount. Obviously, my web host has little to no intension of letting me use all of my allotted bandwidth each month.

I also had some poorly written plugins incorporated with my WordPress software. These were consuming up to 80% of the CPU load on the server and other clients were complaining. My web host eventually disabled my website and told me to not re-enable it until I have the CPU cycles under control. It was obvious that they were willing to sacrifice the one (me) for the many (the other 200 customers on the box).

To be honest, I really can’t blame them for doing that. I would probably have done the same thing. What would have been nice, though, was if they had noticed this high CPU utilization before the Digg Effect hit me and then I could have resolved the issue before it was a problem.

The big thing that you can do here is to make sure that your plugins are playing nicely. The easiest way to do this would be to periodically monitor how much of the CPU your website is using. Use the top command on *nix to get a nice running summary of what is taking up CPU cycles.

One plugin that I do recommend is the WP-Cache plugin. I learned about this from a previous Digg Effect and found that it greatly reduces the strain on the mySQL server. It writes temporary static files that reduce the number of calls to the mySQL server. Really helps to keep things running quickly.

Lesson 3: Share the Load

One of the biggest problems that I ran into was everyone wanting the PC Repair System all at the same time. This put a tremendous amount of strain on my server and bandwidth. Of course, I rarely ran into problems when just the regulars were showing up. But, when everyone and his dog wanted access, that is when things got scary.

3a: Mirror the Culprit

One of the solutions that really helped (thank Rob) was to mirror the primary file to several other locations (thanks everyone for the mirrors). I then made these files available via the download link.

One cool idea that I stumbled upon with this solution was URL Rotator by LJScripts. My concern was that if I were to list all of the mirror locations, people would naturally just select the first mirror. Also, if someone had put a deep link to the file http://www.dailycupoftech.com/Downloads/PCRepairSystem.zip (which I know was happening pretty early in the whole affair), then there would be no benefit.

URL Rotator

This was where URL Rotator came in. All I needed to do was create a directory called http://www.dailycupoftech.com/Downloads/PCRepairSystem.zip and dump the contents of the URL Rotator archive. Then, I could add my URLs via the web interface. Whenever someone clicked on a link to http://www.dailycupoftech.com/Downloads/PCRepairSystem.zip, including ones from outside DCoT, they would then get a random mirror. No more problem!

3b: Mirror the Website

The other thing that was putting heavy load on my website was just hits to the website. As you may or may not know, WordPress is a PHP based system made up of dynamic pages. Each time someone comes to the website, the page is created on the fly. This takes processing power which adds load to the server. This, in turn, slows down my website (and any other website that is on that server).

What I am considering doing is mirroring DCoT to several servers throughout the world. Most of these would get little to no traffic on a regular basis since they are just duplicates of DCoT. In fact, I would probably just create a small PHP script that would redirect each mirrored page to the original website during normal loads. This way, people could still participate in comments which would not be available on the mirrored sites.

But, when I cane under moments of significant load, I would set up a system where I could make a simple change and DCoT would start redirecting people to the mirrored locations. These mirrored locations would share the load with DCoT and everyone would be happy.

Now, the fun part will be figuring out how to do this. At this point, I am looking at using HTTrack or wget. I schedule this to run a few times a day against DCoT and then modify the code so that it can deal with switching from normal to heavy load situations. I think this could be a pretty big project but I have a feeling that it could be worth it in the end. If anyone out there has any ideas about this, please leave them in the comments.

Lesson 4: I Have Friends Out There Willing To Help

This is kind of a rehashing of my earlier post so I won’t get into too much detail. I simply want to point out the if you create a good blog that people find to be useful, they will fight beside you to ensure that it stays up. From e-mails of encouragement to helpful suggestions and advice to right out open offers to provide whatever they can, I was amazed and humbled by the outpouring of support I received. It is to all of you that this blog is dedicated!

I’m sure that I will come up with more insights as the adrenaline wears off and my life starts to get back to normal but for the time being, that’s about it. I look forward to your comments and suggestions.

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?