In WordPress 3.6, an API was introduced which keeps track and manages sessions as well as posts and pages revisions. This function acts like a pulse or a ‘Heartbeat’ – It requires your server to work slightly more in doing so, making it possible to cause performance issues.
Every pulse is around 95/100 Bytes in size, not much, but, the pulse runs every 15 seconds, so if you have a complex site, that is already using extensively the server the Heartbeat Pulse can add stress to your server.
Can we solve it?
Yes we can.
It is ok to solve it? Well many of the pulses don’t so anything they are just chiping in to see if everything is ok, think of it like a bartender that is asking how are you, or if you need to refill your drink, and actually you are in the middle of you drink, everything is fine, AND if the drink is finished and your glass is empty, you can always call the bartender to ask for more.
Anyway, drinks apart, each pulse executes a PHP script, that loads the server, the problem is that script is executed when a user access the backend of the WordPress site and keeps the browser window open, even if is a tab that is hided, and it is executed for EVERY user, that way, WordPress can keep track of revisions and article edition, or who is edition an article. So if you went to sleep and left a couple of browser tabs of the WordPress dashboard opened, in the morning you will have your server admin having breakfast at your bedside, in a black suit and with dark glasses looking like Mr. Smith from Matrix…
How to avoid Mr. Smith?
Well before start tweaking Heartbeat, make sure your site has only installed plugins that are useful to the site, if you have some plugins that are not used, uninstalled them, same with themes, if you use any theme other than the default uninstall them, maybe leave 1 as a safety net in case you need to fix something with your custom or premium theme, any theme prior 2015 can go, there is no need to left them there.
Then if you find useful for your site to use a cache plug in or even a CDN service you can use them too.
Specifically for Heartbeat, there is a plugin called “Heartbeat Control” that does exactly that, it controls the Heartbeat pulse, and where it is not enabled, that is Dashboard, Pages and Posts, or Both, you can disable it completely if your site has only 1 administrator, or 1 author or maybe reduce the pulse from 15 seconds to 60 seconds. If you have lots of users hitting the backend at the same time, you maybe will need a better server performance upgrading to VPS or most likely to a Dedicated server, if you think this is your case, don’t just open your wallet, investigate a little bit more.
For most of the sites that will work, in some cases, your server will detect activity on you “/wp-admin/admin-ajax.php” file and let you know that maybe Heartbeat is giving the server a hard time. You can ask the hosting to tell you what file or folder is eating the servers resources. This problem can be noticed frequently In shared hosting since there are lots of sites that can be in the same situation.
In some servers can be a real problem, and also hit your site performance, so if you are in a shared account, or have a heavy site, this issue can lead to a site suspension, optimize your site, use alternatives to complement the Heartbeat plugin like a cache plugin or a CDN, there are tons of articles that can help, the more optimized site the better, even for SEO purposes, for that reason keep an eye on WordPress Heartbeat and let him know who is the boss.