The WordPress Heartbeat API allows WordPress to communicate between the web browser and your server. It’s serves as a continuous “pulse” or “tick” that is used to perform periodic tasks. The Heartbeat API is used to communicate with your server during ajax calls and sync real-time information – such as log file data – between the server and the WordPress dashboard.
The Heartbeat API sends ajax requests to the server using a core administration file called admin-ajax.php. Depending on activity, a large number of requests can be sent to your hosting server, resulting in high CPU utilization, a reduction in page speed and, potentially, interruption of your service.
If you notice performance issues resulting from a high CPU utilization, tweaking the configuration of the WordPress Heartbeat API may help.
Log in to your WordPress administration dashboard and, using the left sidebar, navigate to Plugins > Add New.
Search for Heartbeat Control, then install and activate the plugin from the list of results.
In the left sidebar, click Settings > Heartbeat Control Settings, to configure the plugin.
The Heartbeat Control plugin allows you to choose from 3 different settings which will tell the API how to operate depending on your needs:
By default, the plugin is configured to allow the Heartbeat API.
If you choose to disable the API everywhere, simply select that option. Bear in mind that the API is used for a variety of functions (for example, allowing only one author to edit a post at a time) alongside a range of under the hood features that will be deactivated if you choose to disable the API.
The last option is to modify how the plugin will work. If you often leave your WordPress admin up for long periods of time, especially while writing or editing a post, the repeated POST requests can cause high resource usage. To avoid this, the heartbeat can be modified or even disabled to lower your server resource usage.
For the purpose of this tutorial, we will modify the Heartbeat Control settings to Override Heartbeat frequency with 300 seconds which will delay the Heartbeat API for 5 minutes.
To do that, select the “Modify Heartbeat” option on all 3 settings there:
- WordPress Dashboard
- Post editor
Of course, you can choose smaller values for the override option depending on the resource usage that is being consumed.
Once the configuration is applied, you can click “Save Changes” to complete the configuration or adjust the settings again.
For further questions, or if you need help, please open a support ticket from your HostPapa Dashboard. Follow this link to learn how.