How To

Run WordPress by itself or cached?

I’ve been running an experiment for the past three months. I wanted to see how well WordPress would do if I ran it by itself, without any sort of caching. So far, so good.

About four months ago, my web server kept getting pummelled into the ground almost daily, and I couldn’t figure out why it kept happening. After researching the issue, I found the prevailing opinion to side with the need for a caching plugin. People were complaining that it’s just not optimized well, and must be run with the aid of such a plugin, otherwise higher levels of traffic will bring the web server down. Trouble was, I already ran my WP install cached, using WP Super Cache, had been doing so for over a year, and my server still went down. (I should specify it had only recently started to go down.) What was I to do?

I posted a message in the WP forums asking why WordPress doesn’t generate static files. Were there any plans to do so in the future? To my surprise, Matt Mullenweg (WP’s founder) replied to my post, and told me that while there are caching plugins out there, WordPress.com doesn’t run any, and they’re doing just fine hosting millions of blogs. Others chimed in as well, and their replies got me to make the following changes:

  1. Made the switch to a VPS (Virtual Private Server) with SliceHost. Four months later, I’m still very happy about that move.
  2. Doubled the RAM on my web server (to 512MB from 256MB).
  3. Turned off WP Super Cache and started running my site by itself.

Each step followed the other in succession. I wanted to make gradual changes so I could see why my server kept having issues. Switching to a VPS host was good, and it was needed, but for my traffic levels, it wasn’t enough. Doubling the RAM was good and it was needed, and while the new RAM is enough for now, I’d still be having problems if I didn’t also disable my caching plugin.

Here’s where I think the crux of the caching/non-caching issue lies: it has to do with the load placed on the server as cached versions of the pages get created. Normally, that’s a non-issue. But as I monitored my server carefully, I discovered that it went down only as it started to get indexed heavily by search engines. Their bots visited my site in spurts, with traffic peaking, then falling back down. They spawned multiple threads, over ten at times, following links and slurping up the content. It’s when bot traffic peaked that an incredible load was placed on the web server. It kept generating cached versions of pages it hadn’t already cached, RAM and CPU demand increased to unsustainable levels, and it went down.

No amount of tweaking the Apache and MySQL config files helped with this sort of scenario, or at least it didn’t help me. You see, the difference between peak traffic levels with search engines vs. people is that people will go to a single article or a group of articles that are in demand. A caching plugin works great for those sorts of situations. There’s a limited number of pages to worry about caching, and those pages get served up time and time again. The load is acceptable. When a search engine bot starts indexing your site, it’ll call up any and all available pages that it can find. That can place a huge load on the web server as it scrambles to serve up those pages and build static versions for the caching plugin. I believe that it’s too much for most medium-sized servers to handle, and they will usually go down.

In my case, disabling the caching plugin and making sure no traces were left in the .htaccess file were the only things that helped. Now, I might have up to four different search engine bots crawling my site, each spawning multiple threads, and my server will usually not go down. Sure, there are times when the server will get dangerously low on RAM, and will be unresponsive for 5-10 minutes, but that’s an acceptable scenario for me. And if I should all of a sudden get huge amounts of people traffic to a post, it’s possible that the web server will also become unresponsive, at least for a time. But the great thing about running WordPress by itself is that Apache will usually take care of itself. As the requests die down, Apache will kill the extra threads, the available RAM will go back up again, and the server will recover nicely. That wasn’t possible while I ran the caching plugin. When it went down, it stayed down, and that was a problem.

I realize that what works for me may not work for others. I have not tested what happens with WP Super Cache on a larger server, for example one with more RAM. It’s possible that the larger amount of RAM there will offset the greater demand placed on the server as it builds static versions of the pages, although I’m not sure what to say about the CPU usage. That also peaked as the caching plugin went crazy. Not sure how that’ll work on a more powerful server.

WP Super Cache has some options that allow you to cache more pages and keep them cached for longer periods of time. Perhaps fiddling with those options would have allowed me to keep running the plugin, but I wanted to see how things stood from the other side of the fence. Like I said, so far, so good. Caveats aside, running WordPress by itself was the cure for my persistent web server outages.

Standard
Reviews

Flash Player 10 breaks teh internets

Shortly after upgrading to Adobe’s new Flash Player, version 10, I noticed I could no longer upload photos to my blogs. And I also noticed that FriendFeed’s image uploader didn’t work the same way. I didn’t relate that to the Flash Player upgrade at first, and tried to rule out problems on my own machine. Then I did a bit of research and discovered that others were in the same boat.

Quoting from this thread on the WP forums:

“The new Flash version 10 is incompatible. The latest version 9 of Flash is what you want. There will be a workaround (ugly hack) for this in WordPress 2.7. But since the problem is actually with Flash 10 itself, stick with Flash 9 for the time being. Hopefully, WordPress 2.8 will get rid of the Flash altogether, since Adobe has made it clear that they consider this problem to be a security fix.”

On FriendFeed (FF), people complained about image uploader issues as well. In that same FF thread, I found out that Adobe archives their old versions of the Flash Player, something which is not readily apparent on their site, nor easy to find. I also found that I need to uninstall Flash Player before downgrading — should I decide to do it — using Adobe’s Flash uninstaller.

Now, we’re faced with an issue: stay with Flash 10 and a non-working image uploader on WP sites, or downgrade to Flash 9? I’ll let each of you decide what to do about that. Since there appears to be a security issue in Flash 9, it’s not something you should take lightly, but at least you’ll have options.

You may think I’m joking in my post title when I say that the new Flash Player broke the internet. Not necessarily. When you consider that there are about 3.8 million blogs at WordPress.com, and at least a few hundred thousand self-hosted WP installs from WordPress.org, that makes over 4 million websites whose WP Image Uploader broke when Flash 10 was released. I’m not sure how many FriendFeed (FF) users there are, but there should be 100,000 or more by now.

The FF developers came up with an alternate image uploader fairly quickly when they discovered the problem with Flash Player 10. WP is going to release a workaround in WP 2.7, then possibly do away with Flash for the Image Uploader in WP 2.8. WP also has an alternate way to upload photos, through the old, form-based browser uploader, where you can only do one photo at a time. That’s what I’ve been using while I wait for the new version of WP to come out.

Still, when you consider that over 4 million internet users were negatively impacted by this new version of the Flash Player, that’s not a number to take lightly. I do wish Adobe had worked with WordPress ahead of time to make the transition smoother or to offer them some sort of workaround. I found out about this the hard way, and my guess is you did, too. That’s not the ideal way to do business when you’ve got Silverlight nipping at your heels.

Standard
Thoughts

Mobile version of site now available

If you happen to browse my site via a mobile device like an iPhone or another web-enabled smartphone, you will automatically see an optimized version of the site that downloads and navigates a lot faster than the regular version on your mobile device.

This was made possible by the folks at MobilePress, who’ve put together a wonderful (and free) WP plugin. My thanks go to them, to Digital Inspiration for writing about them, and to Chris Nixon for sharing that post through Google Reader for me. That’s how I found out about it.

Standard
Thoughts

Changed all site URLs

I pushed through some major changes to site URLs tonight. Every single site URL has now changed as a result, but the change is good, and all old URLs should still work just fine, seamlessly redirecting visitors to the new URLs. Just in case though, please let me know if you find a non-working URL.

The changes have to do with how post, category and tag URLs appear. WordPress, my site’s platform, allows me to change URL rewrite rules (the way a certain URL is generated when you visit a page on my site). I’ve wanted to make this change for a long time, and finally bit the bullet after first trying it out on one of my other sites, Dignoscentia.

Here’s what this means for you:

These changes may not be important to some, but they are to me. Once I get something like this in my head, something that I think will help me organize my content a little better and make the URLs a little shorter and easier to type, I have to go through with it.

I have some more changes planned for the actual categories themselves, such as re-organizing my content into more logical categories. I also need to finish tagging all my posts (currently 1242 posts and counting).

This is all part of my long-term efforts to properly curate my content. You may want to have a look at the site news tag to see what other changes I’ve made to the site over time. It’s been an interesting journey with quite a bit of work behind the scenes, but I like doing this sort of stuff a lot.

Standard
How To

Cannot change WP theme if Turbo mode is enabled

I’ve been wondering what sort of bug I’ve had in my WP installs for the last few weeks, and only now figured out what’s going on.The Turbo mode for WP is done through Google Gears. There’s a bug in the Turbo mode that will not allow you to change your blog’s theme. It works by not displaying the “x” (Close) or the “Activate …” options in the DHTML layer that opens up when you preview a theme.

Try it out if you want. Enable Turbo mode, then go to Design >> Themes and click on a theme that you’d like to preview and possibly activate. It’ll open as a full page instead of opening in a separate layer above the regular page, and the option to activate it will not display. In essence, you’re locked out of switching themes. You have to hit the Back button to get back to the Admin panel, else you’re stuck in a Live Preview mode.

This has nothing to do with file permissions, as I originally thought, or with corrupt theme files. No, it has everything to do with Turbo/Google Gears and the way WP implemented this. It’s a bug that needs to get fixed. The only way to enable theme-switching for now is to disable Turbo mode. After that, things work just fine.

This bug is present even in the latest WP version, 2.6.3. I hope it gets fixed soon.

Standard