WordPress is one of the most popular piece of software, especially as (free) blogging software. And it’s getting more robust and better each release. The problem is, WordPress is notorious for using a lot of memory that used up the server’s RAM (Random Access Memory). One thing that people tend to fail to distinguish is that some or a big chunk of memory are being used for plugins. Some are hunger for memory some are pretty savvy, so you need to know which category is the plugin that you use in!
Some Popular Plugins and The Memory Being Used
To give you some illustrations, let see some of the popular plugins that I use: (I will describe the easy way to measure by yourself the use of memory of any plugin at the end of this article – it’s easy)
|Plugin||Version||Guideline Of Additional RAM needed|
|All in One SEO Pack||1.6.10||1.00||MB|
|AskApache Google 404||188.8.131.52||0.42||MB|
|Broken Link Checker||0.7.4||1.46||MB|
|Chap Secure Login||1.5.1||0.03||MB|
|Dagon Design Sitemap Generator||3.15||0.33||MB|
|DB Cache Reloaded||2.0.2||0.32||MB|
|Google XML Sitemaps||3.2.2||0.09||MB|
|MaxBlogPress Ping Optimizer||2.2.5||0.40||MB|
|NoFollow For Posts||1.0.3||0.01||MB|
|Secure and Accessible PHP Contact Form||2.0WP||0.42||MB|
|Twitter Tools + bit.ly+hashtag||2.0||0.85||MB|
|WordPress Related Posts||1.1.1||0.17||MB|
|WP Security Scan||184.108.40.206||3.95||MB|
|WP Super Cache||0.9.8||1.52||MB|
|WP Widget Cache||0.25.2||0.27||MB|
All the plugin mention above were installed, activated and setup properly in working order inside WordPress. And this table got the data when just displaying Plugin page (wp-admin/plugins.php) on a brand new blog (so no traffic from visitor). So more or less, it was measured on “idle” condition, meaning where the plugin is not really in the middle of its action (of course it depends on the purpose of the plugin). It is the condition just by being active in WordPress.
Just by looking at above table at a glance, you can tell there are some differences in memory usage, some use more than the other.
I myself use around 25 kind of plugins at one time that deemed necessary for the blog to function properly (not to make it prettier, but the real functionality that needed). For example: sitemap for SEO purposes is a crucial factor (then Google XML Sitemap is installed), tracking popularity of each post is important statistic(hence Top 10 plugin is a must), and caching the blog is super duper important (then HyperCache, WP Widget Cache and DB Cache Reloaded are installed always), etc.
Total additional memory for all the plugins that I use will be around 6 – 7 MB.
Your Server Has Limited Memory
There are 2 memory limit that you need to worry about when using WordPress:
- PHP Memory Limit: set by your hosting provider unless you have access to make your own “php.ini” file.. Sometimes even they allow you to do custom “php.ini” they will not allow you to override this parameter. Some other allow you to change this parameter via .htaccess. Check with your host to be sure.
- WordPress Memory Limit: set in wp-settings.php but you can easily define it in side your wp-config.php by using below command:
That ‘128M’ can be change to ’40M’ or ’32M’ or whatever value you want.
From those twos, the one really matter is the PHP Memory Limit because the web-hosting provider will “plan” for the resources of their server.
See, when you are just starting up your blog, I suggest you use managed shared server first (see this article for more detail). This means, one server is used by many user, and each user nowadays can host virtually unlimited number of website. All this website will need some memory to run and the problem is, the server can only have limited memory installed.
For example, some latest motherboard can have 6-slots of DDR3 RAM module that each worth 2GB. Meaning total physical memory that can be installed is 6 x 2GB = 12GB. Say the server overhead (for operating system, networking, etc) need 512MB, so the rest of the memory will be 11.5GB. Say there are only total 100 websites running on the server (this number is very low – but just to give you illustration) – this means if we just divided the memory pro rata for every website, then the allocation of memory will be 11500 MB / 100 = 115MB per website. So, if your WordPress blog require 32MB, then your ‘memory quota’ will can hardly serve 4 visitor at once.
Luckily most of the website probably will have less than 10 visitor a day, so as they come at different time, even if there are more than 100 websites, the server still can have some more extra visitors.
But my point is here, it is in your interest to make the memory usage as low as possible. Because with the same ‘memory quota’ you can serve more visitor. Say you reduce the number of plugin so the usage of your WordPress plus plugin will be around 16MB (from 32MB). Now you can serve 8 visitors at once whole day every day without your hosting provider screaming at you. (For example, if each visitor spend 2 minutes, then you can serve 30 visitor an hour or 720 a day or 21,600 a month – it should start producing you good money with that number !)
This means, you can still stay at cheap shared hosting package until you have enough customer to upgrade to VPS (Virtual Private Server) or Dedicated Server for some even more serious money !
Remember firmly, the web-hosting company will (and they do that every day) suspend your account if you are using the resources too much too many time. Beside memory / RAM the other important resources is CPU load. But we talk about this on different time.
Sort Your Plugin
Therefore, now that you know plugins use memory, and you need to use as less memory as necessary, I suggest to start categorizing your plugin into 3 categories:
- Plugins that need to run all the time: this is all the plugin that is a must. Like I mention above: the caches plugin, statistic plugin, anti-spam plugin, contact-form plugin, etc.
- Plugins that only be activated when needed: this is the plugin that there is no advantage to have it run all the time. For example: Maintenance Mode (just activate it when you are doing the maintenance, after that deactivate it again), Broken Link Checker (just do the check manually every month or so, no need to check this all the time, right?), Fix-rss-feed (probably just need it one off),etc.
Actually, all admin related plugin can be categorized on this category, for example TinyMCE Advanced that add 15 more functionality for TinyMCE editor. This probably just needed when you making apost on the admin area, the rest of the time it can be turn off (deactivated)
- Plugins that can be integrated into your themes directly. Some plugins (for example Adsense’s plugin) only put Adsense’s script from Google on your sidebar. then probably it is better just modify your sidebar.php and put the code directly there. Although the resources to perform the functionality will be the same (whether as a plugin or directly put into the theme file), but it relieves some overheads of the plugin, (for example to register the hook function, checking existence of a function, etc)
How to Measure Your Plugin Memory Usage By Yourself Easily !Like I mention before, easy. Just install what called “TPC! Memory Usage”. you can download it here or directly here. Or even better just install directly from your WordPress (Plugin=>Install Plugin (on your top right hand corner, then search for “TPC”). Once installed (the usual stuff), then do the following:
- Go to its setting (Memory Usage (LHS menu) => Settings) and set Show memory usage in admin footer to “Yes”
- Activate the plugin that you one to measure (one plugin at a time) and set all the parameter/setting properly. (Some plugins will not install itself properly without being correctly setup, hence will give wrong reading to you – so, just make sure it is setup properly)
- Once up and running, go to Plugin Page (wp-admin/plugins.php) and record the footer as pictured on the right. You can do this several time to get multiple reading. But usually it is pretty consistent.
- Now, deactivate that particular plugin
- Go to Plugin Page again, and record the footer as before.
- The difference between step (6) and step (3) are the memory usage of the plugin just for being activated in WordPress
Not difficult, right ?
Now that you can measure the use of memory of any plugin by yourself, it’s time to be selective. There are many plugins made and developed out there. Some by more experienced PHP developer, some got less experience.Some really manage the memory they use, some put more focus on the functionality. But more than 1 plugins can give you the same/similar function, you then need to judge the plugin from different aspect now. The memory usage. For example: All in One SEO plugin and HeadSpace2 are doing pretty much the same thing, but HeadSpace2 is using 117kB more memory than All in One – now you can choose which one…. (Other example: Sexy Bookmarking vs Sociable, HyperCache vs WP-Super Cache, etc)
Of course, the best alternative is: if you don’t really need the plugin, don’t install it just for the sake of installing it.
OK, start sorting those, plugin, okay ? And get ready for more visitor (and then profit) without jack up your hosting cost !