How to Configure the WordPress Heartbeat API to Reduce Server CPU Usage and Improve Admin Performance

XeroWP Aug 12, 2026 6 min read
How to Configure the WordPress Heartbeat API to Reduce Server CPU Usage and Improve Admin Performance

The Silent Performance Killer in Your WordPress Admin

Have you ever noticed your WordPress dashboard becoming sluggish, or perhaps your hosting provider has sent you a warning about high CPU usage even when your traffic seems stable? Often, the culprit isn't a malicious attack or a broken plugin, but a core feature of WordPress itself: the Heartbeat API. While it provides essential functionality, its default settings can be surprisingly resource-intensive, especially on shared or entry-level managed hosting environments.

In this guide, we will dive deep into what the Heartbeat API does, why it might be taxing your server, and exactly how to configure it to strike the perfect balance between functionality and performance.

What is the WordPress Heartbeat API?

Introduced in WordPress 3.6, the Heartbeat API allows WordPress to communicate between the web browser and the server in real-time. It uses a polling mechanism where the browser sends AJAX requests to the server every 15 to 60 seconds. The server then responds with data, allowing WordPress to update information on the screen without a full page refresh.

Key Functions of the Heartbeat API

  • Autosave and Revisions: It ensures your posts are saved automatically as you write, preventing data loss if your browser crashes.
  • Post Locking: If you have a multi-author site, the Heartbeat API notifies you if another user is currently editing a post, preventing you from overwriting their changes.
  • Real-Time Plugin Notifications: Many plugins, such as e-commerce dashboards or security monitors, use Heartbeat to show live data or alerts.
  • Session Management: It keeps your login session active so you aren't unexpectedly logged out while working on a long post.

Why the Heartbeat API Can Slow Down Your Server

Every time the Heartbeat API 'pulses,' it sends a POST request to /wp-admin/admin-ajax.php. While a single request is negligible, the impact scales quickly based on three factors:

  1. Multiple Open Tabs: If you have five browser tabs open on your WordPress dashboard, each tab sends its own Heartbeat requests. This can lead to hundreds of requests per minute from a single user.
  2. Frequent Polling: By default, the API can pulse every 15 seconds while you are editing a post. This constant execution of PHP and database queries consumes CPU cycles.
  3. Server Resource Overhead: Every admin-ajax.php call bootstraps a significant portion of the WordPress core, loading your active theme and all enabled plugins just to process the 'pulse.'

For sites hosted on platforms with strict CPU limits, this 'silent' background activity can lead to 503 errors (Service Unavailable) or significant lag for your site visitors.

Identifying Heartbeat-Related Performance Issues

Before you start disabling features, you should verify if the Heartbeat API is indeed the source of your problems. You can do this using the Network tab in your browser's Developer Tools (F12).

  1. Log into your WordPress dashboard.
  2. Open Developer Tools and click the Network tab.
  3. Filter the results by 'XHR' or search for admin-ajax.php.
  4. Watch the list for a few minutes. You will see a new entry appear every 15 or 60 seconds. Check the 'Time' column to see how long the server takes to respond to these requests.

If you see dozens of these requests and your CPU usage is spiking, it is time to optimize.

How to Configure the Heartbeat API

There are two primary ways to manage the Heartbeat API: using a dedicated plugin or adding a code snippet to your site.

Method 1: Using the Heartbeat Control Plugin

The most user-friendly method is using the Heartbeat Control plugin by WP Rocket. It allows you to manage the API frequency for three different areas: the Dashboard, the Frontend, and the Post Editor.

  1. Install and activate the Heartbeat Control plugin.
  2. Go to Settings > Heartbeat Control.
  3. For the Dashboard and Frontend, it is often safe to select 'Disable Heartbeat' or 'Modify Heartbeat' and set the frequency to 60 seconds.
  4. For the Post Editor, we recommend 'Modify Heartbeat' and setting it to 60 seconds. Disabling it entirely in the editor will stop autosaves, which can be risky.

Method 2: Code-Based Optimization

If you prefer to keep your site lean and avoid extra plugins, you can use a code snippet. Add the following code to your child theme's functions.php file or a functional plugin like Code Snippets.

To change the frequency of the Heartbeat API to 60 seconds (the maximum allowed by default):

add_filter( 'heartbeat_settings', 'xerowp_slow_heartbeat' );
function xerowp_slow_heartbeat( $settings ) {
    $settings['interval'] = 60; // Period in seconds
    return $settings;
}

To disable the Heartbeat API entirely on certain pages (e.g., the frontend), use this snippet:

add_action( 'init', 'xerowp_stop_heartbeat', 1 );
function xerowp_stop_heartbeat() {
    wp_deregister_script('heartbeat');
}

Note: Use caution when disabling the Heartbeat API globally. It can break functionality in plugins like WooCommerce or Elementor that rely on real-time data.

Real-World Example: The Multi-Editor Scenario

Imagine a digital newsroom with five editors working on different articles simultaneously. With default settings, those five editors could be generating 20 requests per minute to admin-ajax.php. If each editor has a second tab open with the main dashboard, that number doubles.

By increasing the heartbeat interval from 15 seconds to 60 seconds, you immediately reduce the server load by 75%. This simple change can be the difference between a snappy admin experience and a server that crashes during peak publishing hours.

Best Practices for Heartbeat Management

  • Increase, Don't Always Disable: In the Post Editor, increasing the interval to 60 seconds is usually enough to save resources without losing the safety of autosaves.
  • Disable on the Frontend: Most sites do not need Heartbeat on the frontend. Disabling it there is an easy win for performance.
  • Monitor After Changes: After modifying the API, keep an eye on your site's functionality. Ensure your contact forms, live chats, or e-commerce carts still function as expected.
  • Use Managed Hosting: Platforms like XeroWP are optimized to handle AJAX requests efficiently, but even on high-performance infrastructure, reducing unnecessary background tasks is a best practice for scalability.

Conclusion: A Leaner, Faster WordPress

Optimizing the WordPress Heartbeat API is one of the most effective 'hidden' performance tweaks you can perform. By reducing the frequency of background requests, you free up valuable CPU cycles for what really matters: delivering your content to your visitors as quickly as possible.

If you are looking for a hosting partner that understands the nuances of WordPress performance, try XeroWP. Our managed hosting environment is built from the ground up to handle WordPress workloads with zero hassle, giving you the speed and stability your business deserves.