Wordpress and Curing High Server Load
So far, my recent conversion of PC Mechanic to Wordpress has been relatively trouble free. Of course, that is a matter of context. Switching publishing platforms on a site as large as PCMech isn’t exactly cake. It doesn’t turn on a dime. So, relatively speaking, it has been relatively pain free. However…
One of the things I have been dealing with is the seemingly much higher demand Wordpress places on a web server. Miraserver ran pretty smoothly and it powered a site like PCMech quite well while keeping the server load down. Wordpress, on the other hand, seems to work the server MUCH more than did Miraserver. We’re seeing average server loads anywhere from 4X to 6X higher than the pre-Wordpress average.
What the hell?!
Now, I will be the first to mention that I am using a bunch of plug-ins here. I currently have 25 active plug-ins in Wordpress for PCMech. It is quite probable that Wordpress would perform better if it were running stock. That said, nobody runs Wordpress stock. Wordpress is more of a platform than a full-fledged product. Yes, it does blogging very well. But, the capabilities are somewhat limited in and of itself and that is why the plug-in capability is so important. However, all those plug-ins do increase the work being done by the server. It is more code to execute.
Thinking of it at the server level, you can see why. Wordpress plug-ins work by using PHP to include files from the plug-ins directory. And then sometimes those plug-is include other PHP files. So, essentially, each and every request to Wordpress is including a BUNCH of files when you are using a bunch of plug-ins. And, many of those plug-ins are called up and included even when they are not being used. For example, maybe you use a particular plug-in only for one page of your site. Well, chances are the file that powers that plug-in is being included on every single request to the site - even when it is not being used.
And therein lies why Wordpress is taking so much horsepower and driving my server load up. LOTS of PHP code. The load on my database server is low. Wordpress is not overworking MySQL at all. The problem is on the PHP side of things. It is executing a lot of code every time somebody hits the page - and that is happening at a rate of 15-20 times per minute. Not to mention my other sites which are on the same server. If I SSH into my server and run “top” to see the currently running processes, I see that each and every HTTP call is generating 1%-3% CPU load. Multiply that by the number of concurrent connections to the server and you can see why I have high server load. The fact that one call to Apache is causing up to 3% server load is really something.
Solutions
Well, one very obvious solution is to thin down Wordpress by way of removing some plug-ins. In my case, not gonna happen. I need these things to make PCMech work like it does. PCMech isn’t exactly your typical Wordpress site. It isn’t really a blog in the traditional sense. So, next option…
Next option is to beef up the server. Now, I am probably going to do this, but not everybody can or would need to. I have two dedicated servers at Pair Networks - one running MySQL and the other running the code. But, as I mentioned above, it is the code which is causing the high load. It also so happens that the server running Apache is the less powerful box. I’ve been with Pair for while, so my server isn’t up to the current specs for dedicated boxes. So, I may have them bring me up to the times and that will surely help with Wordpress sheerly by throwing more processing power at the problem.
But, if code volume is the problem, what if I can just make processing that code either more effecient or not have to do it so often? Well, luckily you can. You have two ways of doing that:
- Wp-Cache2. This is a plug-in which can be installed to Wordpress which will cache your pages. Once installed, your server will have to crunch the code once to create the output. Then, it will cache the output into a file. Each subsequent load of the same page will just use the pre-processed cache and will not need to execute the code again. This reduces load quite a bit, and this is why WP-Cache is such a popular plug-in. I have read great things about this, but I have not yet tried it. I intend to, but the problem on my end is that I provide an ads-free version of my site to paid subscribers. So, I need to make sure the cache takes that into account and does not show the wrong version of the site to a visitor. If I can work that out with this plug-in, I’m there.
- APC Opcode Cache. Also known as Alternative PHP Cache, this is what is called an opcode cache for PHP. To explain this in basic terms, PHP, by it’s nature, is interpretted “on the fly”. And like any computer, the processor ultimately executes machine code, not PHP. So, the PHP interpreter has to convert the PHP code into machine code, then run it. What APC does is caches the machine code, providing much quicker code execution because the PHP interpreter won’t have to crunch so much. I have tested this one and it works great. However, in my case, it was conflicting big time with Zend Optimizer and actually crashed my server. By all indications, this is a problem caused by mixing those two things, not by either on their own.
At present, I am working with my web host to devise a solution. Unfortunately, I have one application (1-2-All) that requires Zend Optimizer in order to function. So, I have to find a way to run this with APC and Zend. I may need to open up my second server to Apache and split my sites up on two boxes, running Zend on one and APC on the other. But, I don’t need to bore you with those details.
Conclusion
Yes, Wordpress can place a LOT of load on your web server if you use a lot of plug-ins. Rather than thin down your code, though, some optimization of your server can go very far in making a highly trafficked Wordpress site run very effeciently.
You Might Also Like:
- Wordpress Borks My Server? Dealing with High Server Load
- Digg, The Server Killer And How To Rescue Wordpress From It
- Yahoo Slurp Spider Drives Forum Server Load Through the Roof!
- Solution - Wordpress Theme Reverts to Default (Kubrick)
- Allowing HTML in Wordpress Profile Descriptions
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.







Great blog! I am an avid fan.