WordPress

Heartbeat API

Heartbeat API is WordPress's browser-to-server polling loop, sent as POST requests to admin-ajax.php with action=heartbeat. It powers post locking, autosave, and the logged-out warning while a screen is open.

How it is measured

The default interval is 15 seconds on the post edit screen and 60 seconds on other wp-admin screens. The front end has no heartbeat unless a plugin loads the script. Each tick is a full PHP and database request, so the cost is requests per minute multiplied by the number of open tabs.

Count them in the browser network tab by filtering for admin-ajax.php, or in the access log with grep 'admin-ajax.php' access.log | grep -c POST over a known window. The heartbeat_settings filter changes the interval from 15 to 120 seconds.

Worked example

A 12-person editorial team on a 2-vCPU VPS sees CPU spike every weekday at 10 am. The access log shows 3,400 admin-ajax.php POSTs in 10 minutes, mostly from editors who left five tabs open on post.php. Each tick runs about 90 ms of PHP.

A small mu-plugin sets the interval to 60 seconds on edit screens and turns the dashboard heartbeat off. The same 10-minute window drops to roughly 900 requests and the CPU graph flattens.

How it differs

The Heartbeat API is a transport that runs inside wp-admin screens. wp-admin is the interface; Heartbeat is a background loop the interface starts. Disabling it completely stops post locking and the session-expired prompt, but it does not remove the wp-admin menu or log anyone out.

Common errors

Turning Heartbeat off everywhere and losing autosave behavior on classic edit screens. Blaming a security plugin for admin-ajax.php load when it is the editors' open tabs. Slowing the interval to 120 seconds and letting two authors overwrite the same post. Not checking that a plugin loads heartbeat on the front end. Rate-limiting admin-ajax.php at the firewall and breaking the editor.

In practice

Look at the last 24 hours of your access log and count heartbeat POSTs per user. If a few people account for most, tell them to close old tabs before you touch settings. Raise the edit-screen interval to 60 seconds if the host is small.

See also

wp-admin, Autosave

Sources

Count this on a real site.

Watch my website