WordPress + High CPU Utilization + Digital Ocean – Fixed$

Digital Ocean - WordPress High CPU

Issue: This simple WordPress site was randomly spiking the CPU for over a year at 75-100%. Once every 2-4 days, sometimes every day. Sometimes for five minutes sometimes for an hour. When checking during an event Apache was always the high CPU consumer. As it’s just a hobby I was interested but not too worried, but… people may be having trouble visiting this amazing website! LOL. The options were to turn off monitoring (fixed!) or see if we could find . We learned a lot on the way as always!

Solutions – that¬†helped but didn’t resolve

  • Database Housekeeping –¬† manually deleted thousands of post revisions and a lot of orphaned database tables and data – here’s some handy SQL queries for cleanup. Ran optimization and tune up plugins. The database dropped from 35megs to 12megs. Ten years of WordPress plugin cruft and changing all settings 2.5 millions times may do that.
  • NGINX – Building a clone of the site using NGINX. I figured a clean build + the optimal (so some say!) website engine for WordPress might do the trick and would be fun to learn. I abandoned when I started getting high CPU reports from Digital Ocean soon after.
  • Fresh start – built a fresh LAMP droplet. All the latest tools and my amazing admin skillz having now done this least 3-4 times. Fresh everything, except the database. Initial hopes soon crushed when High CPU reports started coming in after 4 days and continued. Like the Windows guy I am I tried rebooting as last resort knowing full well it wouldn’t help because, it’s not Windows…
  • Plugins – Deactivating caching and other suspect plug-ins that may perform resource intensive tasks.
  • Update – Apache, MySQL, PHP and Ubuntu
  • Cron jobs – took a look, suddenly found myself in front of a medicine cabinet reaching for an aspirin…

Solution – like a lazy lad I dropped a Lincoln$ on it

  • Resized my droplet – added a second virtual CPU upping my game to 2 vCPUs running with 2gb memory (rocket ship! LOL).
  • Hope – rarely do I give up on thee but why not try learning about adding a CPU, mouse clicks can be tricky.
  • This after years on a single $5 monthly plan then the $10 – now paying $15. Hmm… evil plan by Digital Ocean or just WordPress getting phat with age?
  • *No I do not work in the Digital Ocean Marketing department. Yes I suspect this may just be a plot I’ve fallen into to sell more D.O. services LOL.
Digital Ocean WordPress High CPU
WordPress High CPU goes bye bye

 

print

Leave a Reply

Your email address will not be published. Required fields are marked *