Support » Fixing WordPress » admin-ajax.php is very slow

  • A client was using an ultimate WordPress hosting plan with a major hosting provider. His freshly redesigned blog with a very popular premium theme was seeing a 5 second response from a direct call to /wp-admin/admin-ajax.php.

    It seemed like I was using my C-64 and 300 baud pulse dial modem to dial up a Vax VMS to just retrieve the number zero.

    On the staging server of the client’s hosting plan, we were seeing 1.1 to 1.2 seconds with a direct dial up to admin-ajax.php. On my own web hosting account, I was seeing 0.8 to 0.9 seconds.

    It felt like I upgraded the pulse dial modem to a tone dial modem. Big upgrade. But I’m still on dial-up.

    If it isn’t blacklisted, it is definitely slow. Disabling or throttling the WordPress Heartbeat API did nothing to improve response times.

    It seems the Rest API is having issues as well. I need to look at the Rest API as an alternative to improve user experience without the baggage of admin-ajax.php, but it still doesn’t solve the problem of all these Ajax plugins using Ajax to make cached pages dynamic.

    Should WordPress provide an optimized Ajax handler for plugin developers that we would include in our own php file to call directly? Ajax without the pulse dial modem? Is a 0.2 to 0.3 second response time an unreasonable expectation?

Viewing 1 replies (of 1 total)
  • Dion


    The problem with admin-ajax.php and the REST API is that both load complete copies of WordPress (including plugins and theme) to retrieve that number zero. That includes executing all hooks during the loading process, including the one that loads all available widgets.

    If you want any possibility of a fast site, you must limit (or better yet, eliminate) frontend calls to both.

    FWIW, I don’t think it’s the job of WordPress to provide an optimized AJAX handler. What’s optimized for you may not be optimized for someone else. It’s probably best to write your own optimized AJAX handler.

Viewing 1 replies (of 1 total)
  • The topic ‘admin-ajax.php is very slow’ is closed to new replies.