Identifying Memory Hogs with Wordpress 2.8.2

As you probably noticed, we’ve been having some problems this week, to say the least!

On Sunday night, we managed to have a massive hardware failure whereby one of our servers – the one which powers most of the WordPress driven websites – totally fell to pieces. We had to recompile everything from backup after rebuilding that server, which was a job not without an occasional problem for over 35 websites which are running on that server.

During this time, I grew a beard, slept for about half an hour, and generally stressed about how things might need to change in future.

The problem? Initially, it was caused when the sites were upgraded to WordPress 2.8 – some things were suddenly burning memory. We always have had some small memory leaks on some features, but those which were known were difficult for us to trace, and were on plugins that we really didn’t want to drop (the memory leak being acceptable) however, we realised very quickly that something must be incompatible with WordPress 2.8+, so here is the list of things we KNOW are not working in case you have got some memory hogs following an upgrade:

  • The Options theme version 1.2 or lower – this works for 1.3+, but there is also a fix available for those of you who still have Options 1.2, available here. Fortunately, we don’t have that old version, but the listed incompatibility sent us a bit haywire trying to fix what wasn’t there (we run 1.3 on the sites which still use Options, such as this very site!);
  • The ShareThis plugin – huge issue which we only discovered this morning. It was on every site, and was accounting for around 50% of erroneous memory usage from what I can gather from the benchmarking we did: simple question really, what do you want? a site that works, or one which people could share if they happen to arrive when your server isn’t rebooting for the hundredth time! We’ll hand code the better sharing options into our themes where appropriate from now on – there isn’t any need for the plugin really once that is achieved. Clean up plugins, make WordPress faster!
  • XML sitemaps has an issue where it kept reloading and reloading when doing a manual build – this can be fixed using the solution found here.

WP Super Cache a Memory Hog?

We’re also working on a theory that WP Super Cache is hogging memory and resources somewhat. Basically, on the higher trafficked websites, I’m switching to DB Cache, and benchmarking that. Then we’ll see how it copes with a few days of traffic. If our free memory goes up (and stops the recent gradual plummet) and our CPU usage drops or levels out, we’ll know this was another cause.

What to do if you’re WordPress 2.8.2 is hemorrhaging memory?

Essentially, if you’re struggling after upgrading to WordPress 2.8, I’d suggest the following measures, though note they depend on the severity of your issues: we had major malfunctions,. so started culling things very quickly!

  1. Check your theme compatibility – if necessary disable your theme and see if things improve;
  2. Check the plugin compatibility – use the Wordpress list here (note it is NOT extensive – so add ones you have discovered!)
  3. Find Plugin memory hogs – if you are on your own box, you can disable plugins one by one, each time firing a load of requests at your server using the apache benchmarking tool (I’ll explain how later when I confirm how with the techies) – note how each improves the memory usage and CPU load etc. If you find an obvious candidate turn it off or find an alternative. Also, report what you found as I am here to help others discover the same problem!
  4. If all else fails, roll back and see if things improve – you’ll need your backup database tables to do this (you did keep some when you upgraded, right??!?). We, however, always want to be on the most recent upgrade, so view this as a last resort.
  5. Oh, last minute addition for those of us who are between solutions – i.e. about to move up to a cluster of load balanced servers, or about to move from shared hosting to a dedicated server or VPS: you can get a few more moths [was a typo, supposed to say "months" but I like the idea of moths flying around our dusty old servers!] out of your wordpress if you optimize it heavily, reducing the number of unnecessary database calls! We’ll likely produce a step-by-step guide on this as it really is the major way to speed things up.

If you have any questions you think a man with luke warm skills such as me could help out with, feel free to ask them below – you never know, someone who knows more on such subjects might happen along and answer your question for you!

About the Author

Rob Scott

Rob Scott is a 26 year old originating from Wensleydale, in the heart of the Yorkshire Dales National Park (UK). Rob founded the 24 Hour Trading Partnership which currently owns and runs a series of websites. Rob writes extensively on a number of subjects here and in several other online publications, while, in his limited free time he develops his poetry. Subscribe to Rob Scott's RSS feed by clicking here. Connect with him: read his sporadic Tweets on Twitter.

Leave a Reply

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <blockquote cite=""> <code> <em> <strong>