Load re_compare_panel (from POST request to admin-ajax.php) at the end of post

Pending
REHub - Price Comparison, Affiliate Marketing, Multi Vendor Store, Community Theme REHub - Price Comparison, Affiliate Marketing, Multi Vendor Store, Community Theme October 19, 2020
Login to reply
Igor Sunz Support Agent
4 years ago

Caching ajax has no sense, because ajax is for dynamic functions. If you
cache it, you will lose dynamic part and makes functions as not usable

Guilherme Rodrigues
4 years ago

Hi,

One last question on this subject: would caching of these specific AJAX requests (started through re_compare_panel) work?

I did a simple test on W3 Total Cache setting it to cache /wp-admin/admin-ajax.php, but to not cache wordpress admin user (so to be sure that only the AJAX requests from visitors would be cached, and that if I login as admin on my site I would not be cached).

But testing this configuration shows no improvement on load time of the AJAX request on any page. So I'm assuming it is either not possible to cache these requests or I don't know exactly how to configure W3TC to cache them (maybe only configurable through custom function)?

Any insight on this subject would be greatly appreciated.

Thank you in advance.

Igor Sunz Support Agent
4 years ago

There is no default response. Please, read how wordpress ajax is working,
it has no optimization possibility because its already has only one request
to database and speed is totally relative to speed of server cpu, because
each ajax request loads full wordpress environment. So, your server is not
optimized for WordPress very well.

15 comparison groups is too much.

Ps2 Hostgator is not optimized for WordPress
https://kinsta.com/hostgator-alternative/ anyway, you can try demo of any
other hostings like siteground, wpx, wpengine, kinsta, etc and compare.

Guilherme Rodrigues
4 years ago

I use VPS hosting from Hostgator (which is slow) and I can't change that. This is why I am trying to optimize what I can on the backend.

I have 23 categories in total and no tags. On dynamic comparison settings, I already have 15 different comparison pages configured. The post request on admin-ajax.php (action=re_compare_panel) is taking around 1.0-1.2 seconds.

There should be a way to reduce this duration. There should be a way for the page to quickly load a "default response", given that only a small portion of users will actually use the comparison functionality.

Igor Sunz Support Agent
4 years ago

All ajax requests are already asynchronous from page loading and doesn't
block it. If you have slow ajax on site - means that you have slow server
or too much taxonomies on site (categories, tags, etc)

Guilherme Rodrigues
4 years ago

Hi,

I use dynamic comparison function on my site, and therefore I do need to "accept" a very slow POST request to the admin-ajax.php when loading any post on my site.

I am trying to find a workaround for this issue and would like to know what is the current recommendation from your team about this. Isn't there a way to at least defer this post request to the end of page loading?

Any help would be greatly appreciated.

Additional Info

Link on page with issue (Optional): https://qualescolher.com/audio-video/tv/samsung-tu8000/