Website keeps going down, is it a plugin, database, memory problem, or something else?

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.

Topic memory cache database plugins Wordpress

Category Web


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

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.