Regular CPU faults and spikes of high CPU usage

One of our sites has been experiencing regular CPU faults and high CPU usage during those times. These faults happen at regular intervals – when I first became aware of this it was happening every 3-4 hours. Right now they occur every 7 hours or so. They do not seem to affect the front end of the site besides making it a bit slower to load but they pretty much bring the back end to a grinding halt while they are happening.

We run a local news site (http://sandiegofreepress.org) that averages 1500-2000 visitors a day. We have 6 editors and at times may have 3 editors logged in and working in the dashboard, editing posts or uploading images. This site has been online for 5 years and contains 6,850 Posts, 10 Pages and 28,678 Comments. We are currently using Business Class Shared hosting at MDDHosting.com. This is the site with issues.

We also have another news site (http://obrag.org) on the same server that has been online for 10 years and has 9,435 Posts, 39 Pages and 60,565 Comments. It gets 1000-1200 visitors a day, has one editor posting and it runs very smoothly.

The setup of each of those sites is very different and I only bring it up because they sit on the same server.

I have been investigating this issue for several weeks now. It has not been bad enough that the host has contacted us about it, although I have an open ticket concerning this and tech support there is dismal on this issue. This has been a difficult task because I have to wait so long between CPU faults to see if anything I’ve done has made a difference.

I searched the forums here and found many threads on similar issues but really no solutions. So, here are my details:

Wordpress and all plugins are up to date. This is a list of the plugins installed, active and inactive:

Akismet Anti-Spam - Active
Avatars - Active
Error Log Monitor - Active
Fanciest Author Box - Active
FeedBurner FeedSmith - Active
Heartbeat Control – Active (set to enable only on post editor at 60 second intervals)
ImageInject - Active
ManageWP - Worker - Active
Photospace Responsive - Active
Recent Comment Avatars - Active
Subscribe to Comments Reloaded - Active
WP Crontrol - Active
WP Defender - Active
WP Emoji One - Active
WP Smush Pro - Active
WP Super Cache - Active
WPBruiser - Active
WPMU DEV Dashboard - Active
WPtouch Pro - Active
Yoast SEO Premium - Active
Yoast SEO: News - Active

P3 (Plugin Performance Profiler) - Not Active
Share Buttons by AddThis - Not Active

Genesis (latest update) child theme BlogNews

What I have done to this point:

Disabled all plugins (except Akismet), removed sidebar widgets and switched to the twentyfifteen theme. The problem kept happening, so I disabled Akisment. No joy, so I switched back to our theme and slowly reactivated the plugins. No change.

Disabled wp_cron completely (no help), then added a manual cron job in cpanel to run it. This didn’t make any difference either so I re-enabled it and deleted the manual cron job. I installed WP Crontrol to see if anything in wp_cron was running at the times we were getting the faults but nothing obvious there either.

Disabled the heartbeat API completely with HeartBeat Control (no help), then set it to run only on post editing at 60 seconds.

Installed SmushPro and optimized all images (I didn’t really expect this to help with this issue, but while poking around I realized how many images we had (18,000+) and how badly they were optimized.

Installed WPMU Defender and then realized that we are having a lot of bot login attempts. I set Defender to lockout and ban those with multiple attempts and those using certain usernames. It shows 287 lockouts in the past 24 hours. This led me to download the raw access logs from cpanel and showed me how many bots and spiders are crawling the site.

Added code to the .htaccess file to try and block some of those bots. Still monitoring that.

Installed WPBruiser which has effectively eliminated spam and also shuts out bogus login attempts.

Changed PHP from version 5.3 to 5.6. When I did this we had only one CPU fault in the next 24 hours although the CPU usage continued to spike but not as often. But as the days passed they have returned. We were having 1 or 2 faults at a time every 4 hours, now we may have a rapid succession of 7-8 faults then nothing for 7 hours.

Installed Error Log Monitor which shows me this same error over and over (every 5 minutes or so):

PHP Warning: Cannot modify header information - headers already sent by (output started at /home/sandieg2/public_html/wp-includes/script-loader.php:1328) in /home/sandieg2/public_html/wp-includes/rest-api.php on line 513

I haven’t had a chance to delve into this one too much, but it seems to me that this is not what’s is causing these regular faults and spikes in CPU usage. Hey, I’m just a kinda geek…

I would appreciate your thoughts.

  • Tyler Postle

    Hey Patty,

    It sounds like the high resource usage is primarily due to the amount of traffic you're getting and not necessarily due to a specific plugin/theme functionality that is going haywire, which is a good thing of course!

    I'd recommend updating to PHP 7 if you can as you should see even more performance improvement there. Keep in mind some plugins/theme may not be compatible so I definitely recommend doing that upgrade on a staging version of your site first before rolling it out live.

    Another service that I think would make a big difference in your case is Cloudflare(their free plan should do) or any CDN service, if you aren't already using one. Cloudflare is great for blocking spam bots and should take a decent load off of your own server.

    I'm not sure what your CPU usage limit is but at a certain point you will want to consider getting that increased as well to ensure it can manage the amount of traffic you are getting.

    Hope that helps! If you still have further questions on that or try those solutions and have issues then let us know.

    Cheers,
    Tyler

  • patty Jones

    Thank you for your reply, Tyler.

    Before I updated to PHP 5.6 I ran a plugin that shows whether or not plugins are compatible. All were compatible with 5.6 but several had warning flags for 7. I will take another look at those and see what plugins we can deactivate. Maybe I can contact the plugin authors and ask them to update the plugins for 7. It's worth a shot.

    I had been looking into Cloudflare. I will get that integrated and see how it goes and let you know.

    Cheers!