Skip Navigation

[Resolved] Views queries calling admin-ajax are taking 2-4 seconds

This thread is resolved. Here is a description of the problem and solution.

Problem:

There are calls to admin-ajax.php when I use Toolset Views Slider.

Solution:

The reason you see the admin-ajax loads are that you selected the advanced option to pre-load other pages in Toolset.

Please check the attached screenshot. If you deactivate that option those calls will not happen.

ajax

The option in question is created to mitigate the issue when the next arrow is clicked.

The amount of data is no problem an dit is more of a WordPress thing to get the response and it will take time for sure.

Now, with the option disabled, the initial load will be faster as Toolset will not add an ajax call for the other two items in the slider.

So it will be faster in the initial load. But when the arrow is clicked, for sure it will take time for the next one to be loaded.

If the option is enabled, the initial load will be more as it will try to load the next item too. But then clicking the arrow will be fast.

It will be your choice what to do with the option depending your need and which one (initial load, or fast arrow) is a priority for you.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 21 replies, has 2 voices.

Last updated by alisonC 1 year, 6 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2587095
Screenshot 2023-04-04 165734.png
Screenshot 2023-04-04 165714.png

I run Toolset on many client sites, including the one in this support ticket. Recently, I've been investigating some very sluggish behavior, and I'm hoping you can help me.

Please see the screenshots from Chrome DevTools. I'm consistently seeing these same results across many, many sites that are using legacy views. (The screenshots come from the home page of the site I chose in creating the ticket.)

The servers have plenty of CPU overhead, so I don't think they're the problem. Could you shed any light on why these calls are so slow?

#2587351

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you for the details, I understand that the admin-ajax calls are from the view, but the content used inside the view and the overall environment can have an effect so it needs to be tested.

What I suggest that you do is to use the Lighthouse Chrome extension to measure the performance of the website on the homepage on the scenarios below and get back to us with the result:

1. No theme and no third-party plugins.

- IMPORTANT STEP! Create a backup of your website.
- Switch to the default theme such as "TwentyTwenty" by going to "WordPress Dashboard > Appearance > themes".
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except Toolset and its add-ons.
- Record the performance score.
- Also check the admin-ajax.php call payload and efficiency and see if you see any difference or not.

2. With the theme and no third-party plugins

- IMPORTANT STEP! Create a backup of your website.
- Keep the current theme of the website intact.
- Go to "WordPress Dashboard > Plugins" and deactivate all plugins except Toolset and its add-ons.
- Record the performance score.
- Also check the admin-ajax.php call payload and efficiency and see if you see any difference or not.

3. With the theme and third-party plugins

- Keep the current theme of the website and third-party plugins intact.
- Record the performance score.
- You already shared the payload for admin-ajax.php in this scenario.

Get back to us with the results.

Thank you.

#2587547

Thanks! I'll take these steps on a dev site and get back to you. It may take a week or so for me to get to it, but I'll report back.

#2587559

Christopher Amirian
Supporter

Languages: English (English )

Sure thank you.

#2590483

Okay, I have the results of these. I can send you HTML files of the Lighthouse testing if you'll provide a way for me to share them, but in short, the worst performance was with only the Toolset plugins activated. Here are the scores of your 1, 2, and 3 scenarios:

1. 86 (by far the best score w/ the Genesis theme deactivated, because there are no views on the page; admin-ajax payload not applicable here)
2. 25 (only toolset plugins activated, w/ genesis theme; this score is probably mostly worse because of the lack of image compression; admin-ajax payload slightly better but still high, at 1.38s and 1.40s)
3. 51 (the site as it is in production, w/ all plugins activated and genesis theme)

I'm concerned w/ #2, as I'm seeing sky-high numbers on main-thread work, contentful paint, and javascript execution time. (I know the images are large, and I'm not taking that into consideration here.)

#2590495

Just doing a little more testing to understand the relationship w/ the theme and found something that might be helpful.

I'm working with a copy of the original site on a staging server so I can compare load times quickly. When I go to the slug /industry/industrial-manufacturing, which houses quite a few views in the actual page content (not the theme files), I can test views with and without the Genesis theme.

With the TwentyTwenty theme activated, there are NO calls to admin-ajax.php. With the Genesis theme activated, we see the same behavior I originally asked about, w/ two calls to admin-ajax.php initiated by jquery that each take about 2 seconds.

I can leave the dev site set up like this so you can compare...let me know if I can send you links privately so you can see what I mean.

#2591153

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you for the information.

So with the information you gave, there is something going on in Genesis theme that causes the calls.

Would you please share the login information of the staging website. And give us the link to the page that has the views which can be tested without genesis, and with genesis.

We might be able to find something that can help, but there is no guarantee as we do not know the ins and outs of the Genesis theme.

The fact that no extra calls are called when Toolset is with 2020 shows that the issue is not Toolset codebase per see

But we will investigate more.

Please make the next reply as private while giving the info.

Thank you.

#2591181

Christopher Amirian
Supporter

Languages: English (English )

Screenshot 2023-04-11 at 18.58.59.png

Ok Thank you. For the first step I wonder what is the impact if you as a test go to Toolset > Content Templates Industries (Single)

And remove the shortcodes I annotated in the screenshot? with and without Genesis. Please keep all other plugins deactivated as it is now.

I want to see if the admin-ajax calls changes in that context in Genesis or not.

Also test it with parent Genesis and the child one.

Remove the views and test:

1- With 2020
2. With Genesis
3. With the Child Theme

Thanks.

#2591245

Without these two shortcodes, here are the results:

1. 2020: still 2 calls to admin-ajax.php (same as in original question)
2. Genesis: no calls to admin-ajax.php
3. Genesis child: no calls to admin-ajax.php

Note that I had to activate WooCommerce, as the child theme makes lots of calls to WC hooks.

#2591929

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

So the issues are related to the views in question. As in a situation that you are interested in (Genesis Child) there is no admin-ajax calls without those views.

I checked both of those views and the only thing that I think might be a culprit is the usage of "wpv-post-featured-image" shortcode.

You use the cropping feature with the size of custom, which forces Toolset to do the cropping and that might cause some calls here and there, but I am not sure.

Unfortunately, I can not see any big calls on my chrome browser to be able to determine and I again need to ask you to keep the views intact and this time remove the "wpv-post-featured-image" shortcodes from the views and see what is the final result.

If that is the culprit, try to avoid using cropping feature and use whatever method you already have to do the cropping as you mentioned some big images is used on your website.

I did my best to find something that might be Toolset related here in conjunction with the overall performance.

Thanks.

#2592181

Hi Christopher, I don't see how it could be the views (or featured image sizing) that you asked to be taken away, given that the admin-ajax calls are still happening on 2020 with those views completely removed.

I do find it incredibly strange that the admin-ajax calls happen with 2020 activated, but not the Genesis child theme, with or without the views. This leads me to wonder why Toolset is making those calls. Is there any way you or someone else could dig deeper on this?

It's going to take me a few more days to come back to this, but I'd appreciate it if you could leave the ticket open. Thanks again for your help!

#2592867

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

That is strange for me too. The bottom line is that the Genesis Child is the key now.

So what I suggest is that you enable the plugins one by one while Genesis Child is active, and check the performance, to see in which step the admin-ajax calls come back.

That will lead to the combination of the plugins that might cause the issue.

Thank you.

#2593647

It appears this is not a plugin or theme compatibility problem. I think this is what's happening -- when there is an active Toolset view using Ajax pagination, we see these extremely long calls to admin-ajax.php

Using the Genesis child theme, I activated all plugins, and there was no issue. When views w/ no pagination are added to the active content template, there is no issue. But when I add a view w/ ajax pagination, the calls happen. (In the case of the page we're testing, the view is the featured posts slider in the pre-footer area. When I change the view to have no pagination, no more calls to admin-ajax.php.)

Using admin-ajax.php may or may not be the correct behavior when using Ajax in views, but either way, the length of these calls seems excessive.

#2594651

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

Thank you. Good observation, The usage of admin-ajas.php in Ajax calls in WordPress is a standard procedure.

I will report this to see if I can get more insight and get back to you.

Meanwhile, I want to ask if it is ok if we copy your website from the staging if needed.

Thanks.

#2594851

Thank you! Yes, please feel free to copy the site to your servers.