Skip to content

WordPress admin-ajax.php load — the heartbeat tax on cPanel

WordPress heartbeat fires admin-ajax.php every 15-60 seconds from every open editor tab. On a busy cPanel host with many WP sites, this is measurable load that delivers no user value.

When a cPanel host gets slow and top shows mysqld and PHP-FPM both busy, the request log will often show hundreds of POSTs per minute to /wp-admin/admin-ajax.php with no obvious source. That is WordPress heartbeat — a polling mechanism for autosave, lock detection, and dashboard updates. It fires every 15-60 seconds from every open editor tab, every dashboard view, and on some pages even from public-facing windows. Multiplied across many sites and editors, it is a measurable tax that nobody intended.

What’s happening

WordPress heartbeat is a wp-includes/js/heartbeat.js script that POSTs to admin-ajax.php?action=heartbeat. Each request runs through WordPress init, plugin filters, database queries (current user check, options autoload), and returns small JSON. The total per-request work is moderate, but at 15-second intervals for every open editor tab across every site on the host, the aggregate is significant. A host with 50 WordPress sites and 2 simultaneous editors each generates 100 heartbeats per 15 seconds — almost 7 per second, just for “is anyone editing this?”.

The deeper problem: many plugins hook admin_ajax_heartbeat_received to do their own work. WooCommerce checks stock; analytics plugins push events; backup plugins check schedules. The base heartbeat is cheap; the plugin work attached to it often is not.

How to verify

Find the heartbeat traffic in the access logs:

tail -10000 /usr/local/apache/domlogs/<user>/<domain> | grep admin-ajax | grep heartbeat | wc -l
tail -10000 /usr/local/apache/domlogs/<user>/<domain> | grep admin-ajax | awk '{print $7}' | sort | uniq -c | sort -rn | head

For a specific site, time a heartbeat call:

cd /home/<user>/public_html
wp transient delete --all
time curl -s -d "action=heartbeat&_nonce=$(wp eval 'echo wp_create_nonce("heartbeat-nonce");')&data%5Bwp-refresh-post-lock%5D%5Bpost_id%5D=1" https://example.com/wp-admin/admin-ajax.php

If a single heartbeat takes more than 200 ms, plugins are doing significant work on it. Audit which plugins hook heartbeat_received:

wp eval 'foreach(["heartbeat_received","heartbeat_send"] as $h){foreach((array)$GLOBALS["wp_filter"][$h]->callbacks as $p=>$c){foreach($c as $cb){print_r($cb["function"]);echo "\n";}}}'

The fix

  1. Slow heartbeat down or kill it on the front-end. Install Heartbeat Control plugin or add to functions.php:

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

    Or limit it to admin pages only with wp_localize_script adjustments. For most sites, no heartbeat at all on public pages is fine.

  2. Increase the heartbeat interval. From 15 seconds to 60-120 seconds. Compromise between responsiveness and load: 60s for editing, off elsewhere.

  3. Audit plugin heartbeat hooks. If WooCommerce, Yoast, or another major plugin is doing heavy work on heartbeat, look for plugin-specific options to slow that work (most have settings) or disable the specific hook.

  4. Cache the heartbeat response where possible. LSCache can cache admin-ajax.php?action=heartbeat responses for a few seconds; the loss of immediacy is invisible to users.

  5. Measure after. tail the access log for 10 minutes; heartbeat requests should drop dramatically. PHP-FPM and MySQL CPU should fall in proportion.

This is one of the cheapest performance wins on a multi-WP cPanel host: nobody asked for the heartbeat, nobody notices when it slows down, and the host load measurably improves. Stack Harbor configures heartbeat globally for managed WordPress sites as part of managed cPanel operations.