Ajax slows down WordPress Popular Posts plugin and many others.

WordPress Mobile Speed

Updated


There are no affiliate links on PagePipe.

This request – admin-ajax.php – can cause a 436-millisecond parallel delay. Many try to eliminate the delay. It’s a popular topic on blogs. “How do I get rid of – or speed up – the Ajax request?”

The WordPress Heartbeat API allows WordPress 3.6 and all newer version to:

  • communicate between the web browser and the server

  • improve user session management

  • revision tracking

  • auto-saving

The WordPress Heartbeat API uses /wp-admin/admin-ajax.php to run AJAX requests from the web-browser. Which in theory sounds awesome, as WordPress can keep track of what’s going on in the dashboard.

However this can also start sending excessive requests to admin-ajax.php and leads to high CPU usage. Anytime you leave a web-browser open on a page the Heartbeat API could be an issue.

Are you having an excessive amount of admin-ajax.php requests? You can disable the WordPress Heartbeat API to prevent this from happening.

Change the WordPress heartbeat API behavior. To use fewer server resources, try one of these plugins:

https://wordpress.org/plugins/heartbeat-control/

https://wordpress.org/plugins/ajax-heartbeat-tool/

REFERENCE: https://docs.wp-rocket.me/article/985-how-to-find-which-plugin-calls-admin-ajax-php

A “waterfall” speed test often indicates the heaviest asset on pages is jQuery Ajax.

Ajax adds:

  • 2 requests

  • 39k page weight

  • 200 milliseconds load time

But you can get a double load of another 33k from Google CDN. So WordPress core and a plugin may request different versions of Ajax. This is inefficient but not critical.

Ajax is a heavy web asset. AJAX is an acronym short for “Asynchronous JavaScript And XML”. It’s a library of backend code. It allows websites to load content onto the screen without refreshing the entire page (dynamic content). It isn’t needed by core – nor a theme. So activation is usually a plugin or script.

From online references, Ajax activation happens with add-on services. For example, ConvertKit tracks form submissions. We see it  activated on WooCommerce sites with dynamic Cart Fragments. And the WordPress Popular Posts plugin.

“Starting version 4.2.0, WordPress Popular Posts can cache views data in-memory (Redis, Memcached, etcetera) and batch update the views count of your posts and pages when more than 180 seconds have passed since the last batch update, which greatly reduces the number of database writes. This of course also means better overall performance.”

REFERENCE: https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance

WordPress Popular Post plugin adds 400 milliseconds to global page loading (Boo!) and only 4k to page weight.

Ajax is often used by WordPress developers to create dynamic and interactive plugins and themes. Some popular examples include adding features such as live search, product filters, infinite scroll, dynamic shopping cart, and chat box. Just because a plugin uses Ajax doesn’t mean that it’ll slow down your site.

How to Diagnose High Admin-Ajax Usage on Your WordPress Site
https://kinsta.com/blog/admin-ajax-php/

There is no easy fix today when it comes to reducing Ajax page weight. Maybe in the future?

Godspeed-

Steve Teare
performance engineer
September 2023

 

PagePipe Site Tuning Services for Speed

Instead of band-aid approaches, we drill down to the root cause of your slow site. This is origin optimization. Also known as site tuning. To do this, we analyze site components:

  • Hosting
  • Theme
  • Plugins
  • Scripts and third-party services.
  • Images and media library.
  • We minimize globally loading plugin effects.

Find out more details about Site TuningGet Speed!