So I've been having a problem with one of the websites I manage. Essentially, we keep seeing the cloudflare 'site is offline' message for at least half the day, constantly and consistently. Whenever the web host is contacted, we always get the answer that it's a problem caused by plugins, but I want to know if:

  1. Is it actually too many plugins? https://paste.ee/p/PJLx5

  2. The website is a news aggregation website that's been around since about 2012. We're wondering if all the articles posted (at least 3-4 per week) are clogging up the database and making things slow.

  3. We get this error occasionally when attempting to update/publish drafts:

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 105 bytes) in /home/SERVER_FOLDER/SITE_ADDRESS/wp-content/plugins/w3-total-cache/lib/W3/ObjectCache.php on line 184

What could be causing this error and how can we solve it?

This could be a symptom or a separate problem, but I just wanted to mention it in case it's relevant: When we try to schedule posts and the website is going up and down, the schedule button has a tendency to grey itself out for what ends up being a majority of the day (even upon refreshing the page, etc.).

Finally, we use W3 Total Cache because it was recommended by the host, but we were wondering if this was truly the best option (or if it just didn't matter which cache plugin we choose as long as it's reputable).

EDIT: Yes, current Wordpress version (4.3.1) is being used.

  • That error code is from the W3 Total Cache plugin. – matthew Oct 10 '15 at 1:58
  • 1
    Disable W3 Total Cache for a while and see if that works. Disable other non-essential plugin too. And check the logs. Are you on shared hosting? – Robert hue Oct 10 '15 at 4:15
  • 2
    Apart from this being an error generated by the plugin in question, issues like this is really really hard to answer as it could really be anything, anything that we do not have access to or neither know about. I think you might be running really expensive queries, the best option here is to download and install Query Monitor and then use the plugin to check exactly what is really causing all the issues in the first place. You should not normally have more than 50 queries per page load – Pieter Goosen Oct 10 '15 at 6:29
  • What host do you have? – bestprogrammerintheworld Oct 10 '15 at 7:05
  • @Robert We're using a VPS (300MB RAM) on Dreamhost. – Emily Serven Oct 11 '15 at 15:44

Allowed memory exhausted is generally generated because the server can't handle the memory usage of your site, and the actual memory issue can, as Pieter Goosen mentioned, really be anything on the site.

Answers to your questions:

  1. It's not too many plugins. Wordpress can handle it :-)
  2. Probably not. If the storage of your website is very very limited this would be a problem, e.g. if you have a database of 10GB and your website has a storage of 10.2GB, then of course this would be an issue.
  3. It's obviously the W3 Total Cache plugin that is generating the error, but that doesn't mean it's a problem in that plugin.

I would recommend these steps to debug...

  1. Check with the host if it's possible to change the memory limit on the server. ini_set('memory_limit', '-1'); would set memory for unlimited usage, but if it's a shared host this would probably not be possible.

  2. Copy your production site (with a plugin like Duplicator) to a local server. Is it the same problem with it being slow?

Do the testing on your local site...

  1. Try to deactivate the plugin (as you usually deactivate a plugin). Check in a browser, being sure to refresh the cache! Alternatively, if you have the option, check in a totally new browser that you usually do not use (just to be sure that it's not the cache that is messing things up).

  2. Try to remove plugins one by one... and test.

  3. Remove the W3 Total Cache plugin. This is a good tutorial on how to achieve that.

These above steps I think/hope will give you a clue what's going on.

Yes the W3 cache plugin is what the fatal error references but the actually problem is your website is trying to allocate more memory than your hosting account allows.

Now granted 134217728 bytes is like ~130MB which is pretty good (default is like 40MB, shared hosts normally go to max of like 128MB) ... but that is how much memory one php instance can consume.

Each plugin you have activated on your site takes up a certain amount of memory ... if when you are updating a post or something else you get that error, it could be due to whatever is being run through hooks and processing at that time to use up all that memory.

I would recommend running the P3 Profiler just to see where plugins come out at ... there could be just one faulty plugin or it could just be the combination of them all.

https://wordpress.org/plugins/p3-profiler/

EDIT: Just noticed you had it in your plugin list, which is pretty small, what were the results though?

You mentioned that you use CloudFlare, when you get the error that your site is down, have you tried accessing it directly from the server? What does your hosting company say, you should ask them ... I say this because my hosting company gets these kind of questions everyday

EDIT: Missed hosting company saying "its plugins" ... but don't accept that type of answer from them, especially if you're paying for managed hosting. If you tell them when the problem was they should be able to tell you exactly what they can find in the error and access logs ... don't let them skate out with a BS response.

If you really want to dig into it, you can use a plugin like Query Monitor (https://wordpress.org/plugins/query-monitor/) or Debug Bar to track down queries and what is causing high memory usage

Good luck

  • You can test access directly to your server by setting the IP in your hosts file and then trying to load your website smyl.es/… – sMyles Oct 10 '15 at 7:44

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.