Check which plugins or processes are using high admin-ajax.php

A plugin or process can start max’ing out your hosting server by using a high level of admin-ajax.php usage, typically this may involve WooCommerce.

You can create a log file and monitor which processes/plugins are using it.

In your themes functions.php add in a temporary php function:

add_action( 'init', function () {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_REQUEST['action'] ) ) {
file_put_contents( WP_CONTENT_DIR . '/admin-ajax.log', date('c') . ' - ' . $_REQUEST['action'] . PHP_EOL, FILE_APPEND );
}
});

Create a file admin-ajax.log in your wp-content directory and tail it

tail -f /wp-content/admin-ajax.log

Now you will see normal processes like heartbeat, but also others which may give you a clue to which plugin is causing the issue.

In my case I had the process as_async_request_queue_runner which interacts with WooCommerce Scheduled Actions which had a broken MailChimp config resulting in multiple actions hitting admin-ajax.php

Leave the first comment