WordPress Heartbeat (wp-admin/admin-ajax.php)

heartbeat-control-plugin-wordpressWhile monitoring Stats of my websites wp-admin/admin-ajax.php was always on top of the list of most requested pages which made me wonder, Why is there so much activity from the wp-admin/ folder? Nobody (no regular visitor) is supposed to go there / request a page from the admin folder, right?

As it turns out as of WordPress 3.6 The WordPress Heartbeat API was added to establish communication from the WP Admin panel to the Server to keep track of the actions of the dashboard / wp admin panel. It is used for auto save, post locks (multi user) and it will check from browser to server every 60 seconds when the browsers has focus, and 120 seconds if browser is not used. This will occur when you are logged in to WordPress (which for me is 24/7 with WordPress in 2 tabs: 1 for wp-admin, 2 for the front-end view.

Default heartbeat while editing posts is 15 seconds. So don’t keep your post editor open when you don’t need to.

1440 page requests

Doing a quick math shows that having 2 instances of my WordPress site open (not even working) this wil result in 1440 page request for wp-admin/admin-ajax.php.

So lately I was wondering why I reached my hosting BPU on a website which was not yet open to public, I was still working on, it was not index and put mostly in maintenance mode! I guess that explains (partially) why.

Disabling HeartBeat

I’m not totally fan of disabling the heartbeat since auto save is very useful sometimes. But I think we can do with less ‘control’ of the heartbeat, but you decide for yourself, in a multi user environment it might be very usefull, and there are way to prevent the heartbeat (make sure you log out of wordpress)

For me the best way was to use this heartbeat control plugin. I have set it to ‘Allow only on post edit pages’. Which for me makes perfect sense.

Check Email Plugin

A while months ago (long before finding out about the heartbeat) I was having serious perfomance issues with my site when logged in. After a long period of testing (disabling / enabling) plugins I found that the check email pluging caused the issue. I had been using this plugin over a year, that is it was active for that period of time, and I never had those kind of issues. Now I think that the performance issue occurred after when I finally decided to upgrade to version 3.9. I had been using 3.5.1 for far to long as I was afraid my site, a web-shop with about 300 visitors a day, would crash, So for my 3.9 was the first version with the heartbeat control. Disabling the plugin worked fine and Since it was only for testing my email settings there was no need keeping it active.

4999 Total Views 2 Views Today

One thought on “WordPress Heartbeat (wp-admin/admin-ajax.php)

  1. Pingback: Wilson Jersey

Leave a Reply

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

Comments Protected by WP-SpamShield Spam Blocker