How To Reduce WordPress Memory Usage
Small Disclaimer: WordPress itself doesn’t really use that much memory, the increase is normally noticed on established WordPress installs with plugins and themes installed.
Use A Caching System
One of the biggest memory hogs while using WordPress is actually PHP. All of the memory required to build your pages is used by PHP, which depending on the amount of SQL queries needed & plugins used can be upward of 20-30 MB. To stop the need to use that amount of memory every time a page is loaded the best thing you can do is install a caching plugin. The most well know ones are WP-Super-Cache & Hyper Cache. I have used them both & can recommend both as excellent caching systems.
If you are struggling to understand how a caching plugin will help, here is a little description. A caching plugin basically waits for a page to be loaded via PHP then takes a flat HTML copy of the page and loads that the next time someone wants to view it. It’s obviously more complicated than that, but that is the general idea behind it.
Limit Plugin Usage
One of the greatest things about WordPress is its extendability via plugins, but therein lies another of its problems. Using too many plugins can cause WordPress’ memory usage to go through the roof, so the best thing to do is use only the plugins you need. If you have any you don’t use any more, disable them. Go through ones you are using & consider if you really need them or not. This is not to say that every plugin does increase memory usage, but to the general WordPress user the best advice is to disable as many as you can.
For those that are WordPress savvy try disabling plugins that use a lot of MySQL queries, do heavy calculations, or place a lot of information in memory. If you find that some plugins are essential for the functionality of your site, keep them enabled & try to save memory in other places.
Google Gears
Something not many WordPress users consider is memory usage while you are in the admin. The amount of memory used when saving a post or even just loading a post for editing can be quite high sometimes. To keep memory usage low until you need to save a post/page etc you can try using Google Gears, or Turbo as WordPress calls it. You can enable it by installing Google Gears & then going to the Tools -> Tools in WordPress.
Unfortunately Gears is not compatible with FireFox 3.6 and it is currently unknown if Google plans to update Gears or not with the recent announcement that they are going to concentrate on developing offline file access for HTML5.
Any More?
Well those are my tips for saving memory, but it is by no means an exhaustive list. If you have any other tips please share them. I’d love to hear other ideas, and if you are ok with it, I’ll add them to this list. Also if anyone has any other tips on reducing the memory used in the admin I’m all ears.
WordPress logo © WordPress · Composite by Lisa Marie
15 Comments
Alex
Getting fairly tough to find a RELIABLE open source server these days! Thanks for the post! Fortunately, I found a GREAT company to use!
Paul Robinson
Yeah, I must admit it took a while for me to find the host I use now. I’m very happy with the service they give for the price. All of the software they use is open source & if My site does outgrow my hostingthey offer upgrades. 🙂
I use DreamHost if you were wondering.
Chris Strosser
Being knowledgable about the resources each plugin uses is very important. I wrote a plugin to help administrators monitor WP memory usage, CPU usage, security, settings, among other things. It’s great for finding out whether or not a plugin is resource-friendly. Other plugins only offer support for overall memory usage, whereas this allows WP admins to measure memory usage anywhere there is a filter or action.
http://wordpress.org/extend/plugins/tpc-memory-usage/
I hope you all find this useful!
Paul Robinson
Thanks for posting that Chris.
It’s always nice to have more information. I think I might be turning obsessive compulsive about finding out how much memory I’m using etc, I don’t know if that’s a good thing or a bad thing. 😆
I will most definitely check out your plugin though. 🙂
Seth Merrick
An alternative to reducing memory usage is to increase the memory limit! With the brand-new Cobalt WP Boost plugin, it’s now possible with just a couple of mouse clicks.
Check it out here:
http://frugaltheme.com/about/cobalt-wp-boost-plugin/
As someone who uses a powerful framework theme with a couple memory-intensive but mission-critical plugins, I was starting to feel the memory crunch. WordPress’ internal Memory Limit is only 32MB, even in the beta release of WP 3.0. Since most servers nowadays allow much more than that, it makes sense to have a plugin that can give your site a little more breathing room when there’s just nothing left to optimize.
Donny
Great info!i found this tips was help me to solve my problem,thanks!
Paul Robinson
Thanks Donny. Glad it was helpful. 🙂
zik
actually what is the recommend total plugin to use it?? or it depend to blogger, or theme???
Paul Robinson
The one I use at the minute is called W3 Total Cache and is a kind of mix between WP-Super & Hyper Cache. However I’ve heard good things about the new versions of WP-Super Cache. It’s down to which one you think sounds the best.
WP-Super Cache (in my experience) is easy to set up. W3 Total Cache is harder, but had a lot more options.
rahul chauhan
Hey,Thanks for this ultimate list buddy.I really helped a lot.. 🙂
Lord Template
each hosting sometimes give it limits the use of memory and why if the excessive use will cause a “fatal error out of memory”
Thank’s for information.. 😉
Mahesh
In my wordpress installation I used bbpress plugin. It has around 10 other plugins too. Whenever I see the memory usage it is almost 39 Mb although the memory liimit is 32 MB. Only Wp-widget cache and Db reloaded Fix cache plugins are installed. Is there any problem if it crosses the Memory limit?
Paul Robinson
Hi,
Your memory limit can be temporarily increased by the script running, if your server allows it, that may be how you are able to use more memory than your PHP settings allow.
If you really hit your memory limit PHP will throw a fatal error & stop execution of the script.
SAM
memory limit shows 32mb and as i activate buddy press it consume 95% of memory and this is not much. i want to know wordpress only take 32mb or its just an assumption . past few days i have seen my vps memory being whole consumed by apache.
Paul Robinson
WordPress can use anywhere from 16MB (on an incredibly lean install) all the way up to 40MB. My install uses 26 – 33MB depending on what is being loaded. I am also able to use the new ImageMagick features so that takes the weight off PHP a little.
Apache consuming your memory is unusual as it doesn’t really relate to PHP, unless you are running PHP as an Apache module. Personally I don’t like it when PHP is ran as a module and prefer CGI/FPM instead, as such I don’t really have much experience debugging memory use when PHP is running as an Apache module.