• Hi. If you visit the site after it wasn’t visited for a while, admin.ajax.php request timeouts after 30 seconds. Every subsequent visit is loaded extremely fast. What are the steps to troubleshoot admin-ajax calls and loading? Is there a plugin or some logs that would hint at the problem? It’s extremely difficult to reproduce on it’s own since it happens after a few days of no visits to the site (it’s a staging site).

    Setup: WordPress 6.2 + WooCommerce + Storefront theme, everything up to date.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator bcworkz

    (@bcworkz)

    There’s likely some caching scheme in place that allows good performance most of the time. Until the cache is flushed and needs to be re-primed.

    Performance issues with WooCommerce are often due to memory limitations. Check the allowed memory allocated for PHP in Tools > Site Health > Info > Server. Also check actual usage in your hosting’s cPanel. In some cases with shared hosting this is maxed out even though there’s enough for PHP. If any other server resources are maxed out or experiencing errors, they could be the cause of poor performance.

    Thread Starter hbrg

    (@hbrg)

    Thank you for the reply. There are no caching plugins installed. Almost everything is disabled for testing, except a shipping plugin, Loco Translate, custom post type UI and page cloning for admin backend.

    There are no performance issues – this admin-ajax timeout occurs only after not visiting the site for a few days. Memory limit is 256M. Is there a troubleshooting tool, a log or recommended steps to try to figure out why the timeout occurs? Like, what called admin-ajax at that point?

    Site Health also lists:

    “Page cache enhances the speed and performance of your site by saving and serving static pages instead of calling for a page every time a user visits.

    Page cache is detected by looking for an active page cache plugin as well as making three requests to the homepage and looking for one or more of the following HTTP client caching response headers:cache-controlexpiresagelast-modifiedetagx-cache-enabledx-cache-disabledx-srcache-store-statusx-srcache-fetch-status.

    •  Median server response time was 639 milliseconds. It should be less than the recommended 600 milliseconds threshold.
    •  No client caching response headers were detected.
    • ?A page cache plugin was not detected.”
    Moderator bcworkz

    (@bcworkz)

    Thanks for the additional info. It seems the most common causes are not at play here. You could try out a few of the plugins from this search to see if any would help you.

    Thread Starter hbrg

    (@hbrg)

    Thank you. The profiler didn’t find anything out of the order. I guess I’m wondering if there is a log where it says what triggers admin-ajax call.

    Moderator bcworkz

    (@bcworkz)

    There’s the access log, but if it’s a POST request it will not be very helpful because you need to find out what the passed action value is to have a clue to what element made the call. However, if it happens to be a GET request, then action will be part of the URL’s query string.

    If you do learn the action value, you could recursively grep (full text search utility) the entire code base in hopes of finding the callback function that in part uses that value in its name.

    You could build a simple log function hooked to “init” action. If DOING_AJAX is true, log the $_REQUEST['action'] value to a file. Probably along with a time stamp so you can focus your search in a limited time period since you will end up logging tons of inconsequential calls along with the problem one.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘admin-ajax.php timeout after not visiting the site for a while’ is closed to new replies.