How much do you know of what the WordPress Heartbeat API does to your site. Especially if you are logged in as admin and have your post page open. The WordPress Heartbeat API, introduced in WordPress 3.6 – allows your browser to communicate with the server when you’re logged into the WordPress admin panel.
You can refer to it as a “beat” and is responsible for revision tracking, session management, showing other authors that a post is being edited by another user, plugins can hook up to those “beat’s” and show you notifications in real time and more.
The beat is around 98 Bytes in size, but it can cause performance issues in certain situations.
On different pages, Heartbeat makes checks on different period – on post edit, it makes it every 15 seconds on the post admin, on your Dashboard – every minute, etc.
The API uses the /wp-admin/admin-ajax.php file to make AJAX calls. If you notice a significant amount of POST requests by that file or you have been contacted by your hosting company that your account is using too many resources and cite POST /wp-admin/admin-ajax.php as the cause, it’s likely due to the Heartbeat API.
The problem is compounded by the fact that each user who has access to the backend of WordPress generates a “beat”. As the number of users navigating the WordPress backend simultaneously increases, so does the number of beats generated from the API.
You can limit the work of the Heartbeat API or you can stop it completely, by using the WP Thor HeartBeat Plugin. With the WP Thor HeartBeat Plugin you can change the frequency of the “beat” or you can switch off the heartbeat completely.
Personally I have it switched off heartbeat, as I do not do any writing (no need for revisions), just some final edits is all I do. I use Google Drive to write my blog entries. We are all different, and I do recommend that if you’re more than one person working in the WordPress admin, that you have Heartbeat on.
You could consider also to use WP Thor HeartBeat Plugin, If a web hosting provider has strict limits on the number of processes or resources used, you could easily go over the limit.
If you need to use WP Thor HeartBeat Plugin, simply install WP Thor HeartBeat Plugin by following the standard instructions on how to install WordPress plugins and activate it. Then go to WP Thor Heartbeat and in general settings select the heartbeat frequency. Finally, save the settings and that’s it.
If you want to, you can set heartbeat to work from a different locations only – like on your post and edit pages for example.
How it works
When the admin web page loads, the client-side heartbeat code sets up an interval to run every 15-60 seconds. When it runs, heartbeat gathers data to send via a jQuery event, then sends this to the server and waits for a response. On the server, an admin-ajax handler takes the passed data, prepares a response, filters the response, then returns the data in JSON format. The client receives this data and fires a final jQuery event to indicate the data has been received.
Try the WP Thor HeartBeat Plugin to limit the number of requests going from client-side browsers to the backend server. Not only will it mean fewer requests to the server, but it may lead to a performance increase as well. It’s a “free” plugin so try it today.