Fighting The Wordpress Dragons
What follows is a quick tale into the technical details of Wordpress that I’d rather not think about, but was forced to…
Over on PCMech, I have been having a cyclical and perplexing issue with server load. The end result was that PCMech disappeared from the Internet for a few minutes at a time, several times per day.
Extremely frustrating to say the least. Especially when you pay your web host about $700 per month to keep these sites online.
A few weeks ago, I started host shopping. I am with Pair Networks now, but I started talking with the guys at Rackspace. Both great companies. Rackspace is certainly more proficient with their marketing, but they also back it up. I’m not even a customer and I can tell that their “fanatical support” is indeed what it says. That said, Pair is no slouch either. Pair is always spot on with their email replies and they get the job done.
At the end of the day, I’ve got a business to run, however. As good as Pair is, if they can’t get it done for me, I switch. The prospect of moving all of my sites to Rackspace wasn’t exactly one I wanted to confront. At the last minute, fortunately Pair came through for me and offered to throw a lot more hardware in my direction. Essentially, it was an offer I couldn’t refuse.
As I had left it, Wordpress was still proving to be a beast, but we threw so much hardware at it that it was acceptable. Still, PCMech was slower than other sites.
Fast forward to this morning. PCMech is gone. Buh bye. Wordpress is delivering nothing but blank pages.
When I check out the cache, it looks like the problems started shortly after 4AM.
I was clueless. And, again, my host was pissing me off. I pay these guys so much money, and essentially I was getting fast responses and some hints about the problem, but no solutions. They told me, essentially, that they weren’t that familiar with Wordpress. This was surprising considering Wordpress is pretty much the most common blog platform on the net.
After wasting several hours on it, all while PCMech was offline, I was beginning to feel pretty damn helpless. I started thinking about my personal network of contacts.
Mark Jaquith came to mind. He seemed ideal. He lives local to me, we know each other, and he also happens to be one of the lead developers for Wordpress. So, I decide to invade his space, look him up on Skype and I interrupt his day.
In short, Mark saved my ass. He’s a good guy to know.
Come to find out, there are two problems at play here…
Wordpress Options Table
The Wordpress database has a wp_options table. By design, the Wordpress code queries pretty much every row from this table on each page view (specifically, the ones marked “autoload”).
Well, my options table had over 600 entries and was over 23MB in size!
Mark cleared out some bogus entries, shaving the table down considerably. I went in afterward and removed a bunch of crap from old plug-ins.
Seriously, plug-ins add a bunch of CRAP to your options table. When you deactivate the plug-in, that crap remains in there and is queried out of the database each page view. It is excess baggage. I had to go in and remove entries by hand.
This alone brought PCMech back from the dead. The consistent queries which were returning a result set of over 20+ MB was just killing the server, eating up all the memory, and causing Apache to restart cyclically.
Apache Process Size
This issue remains unsolved as of now, but I’m working on it.
Each Apache process is using up about 50MB of memory. That is insanely high. Wordpress itself, we have ascertained, is only using around 5.5 MB. I’m not loading excessive images from the server, and all videos are hosted offsite.
Still to look into is whether we’ve enabled a bunch of Apache modules that are being called up that I’m not even using. I’m also going to look through the code and see about thinning down the number of images.
Every image and every video (essentially, every single file) has to be served by Apache. Lesser is better.
Wordpress Is a Beast
Wordpress is very query-intensive and uses a lot of memory, especially when you have it loaded up with plug-ins. Of course, I am also using vBulletin on this server, and it uses a lot of database queries, too.
When you start subjecting it to high traffic, it can really take your server to its knees. Some other things I have done include:
- Getting rid of all unessential plug-ins.
- Installing an opcode cache (like APC or Eaccelerator)
- Installing WP Super Cache.
- Host databases on a separate server. This is the reason I actually have TWO servers with Pair Networks.
I’m going to continue to watch the server and watch that uptime.
I guess this is the kind of stuff you deal with as part of being a pro blogger.
Oh, and thanks again to Mark. You da man!
If you enjoyed this article, you might also like...
- Wordpress and Curing High Server Load
- Wordpress Borks My Server? Dealing with High Server Load
- Digg, The Server Killer And How To Rescue Wordpress From It
- My Blog Was Hacked (I Think) – The Story
- Solution – Wordpress Theme Reverts to Default (Kubrick)
-
iphone clone
-
Christian Russell
-
Adam Capriola
-
joebwharton
-
Chris @ Driving Spirit
-
imegent78
-
Alberto
-
David Risley
-
Bruce Inouye
-
David Risley
-
John Paul
-
Steve
-
Antti Kokkonen
-
Dan Rippon
-
David Risley
-
Richard60
-
cbahm
-
Dave Doolin
-
ericabiz
-
Dave Doolin
I'm David Risley. I've been making my living as a blogger for over a decade. Blogging is my business and how I support my family. With this blog, I'm just gettin' REAL and telling you how this business works.








