Site icon gordsellar.com

WordPress’ admin-ajax CPU Problem: Finally, a Solution

So, since about WordPress 3.6 I’ve had a problem with CPU overload on my blog. Mostly, I think, visitors won’t have noticed, but for me, on the backend, it’s been a royal pain: it occasioned my recently changing my theme, and has made posting a real chore. (Write. Copy text version. Click Publish. Wait and see if it goes through, or bounces.)

My CPU was being overloaded by the WordPress script admin-ajax, which, if you do some research, supposedly gets called sometimes by a badly designed plugin. Except, I checked all my plugins, and they didn’t seem to be the cause of the problem.

Turns out there’s some kind of API feature that was added to WordPress in version 3.6, called the Heartbeat API. Everytime I leave the admin access panel open on my site overnight by accident, the CPU was basically hogged to death. This seems to have caused a lot of problems for a lot of people, but the last time I searched for a solution, I couldn’t find one. Today, though, I found this post discussing the issue, and using the code inside it, I seem almost in a single shot to have solved my overload problems.

I think. We’ll see. Everytime I post something about having solved this problem, I regret it a day or two later. But the change in my site’s behaviour has been so rapid, after adding this code to the functions.php for my current template, that I can’t help but feel optimistic.

Oh, and for those who want to fine-tune it a little more, check this out.

Exit mobile version