- This topic has 14 replies, 3 voices, and was last updated 3 years, 7 months ago by
Tom.
-
AuthorPosts
-
February 3, 2022 at 11:35 am #2104327
pairfum
Dear Support,
Using the Query Monitor plugin we found the following slow query:
https://i.imgur.com/HYKKjct.pngThis is the url of our staging site:
https://staging.pairfum.comWould you have any suggestions how this can be improved?
Kind regards,
Pairfum London
February 4, 2022 at 12:13 am #2104743Fernando Customer Support
Hello Pairfum,
I tried running Lighthouse on you website and the most significant issue was “initial server response time”.
See this as reference: https://share.getcloudapp.com/5zunOdA9
One potential cause for this is a slow server which could in turn be the cause of the slow query.
See this for reference on things that could cause slow WordPress queries and how to address them: https://www.wpspeedfix.com/speed-up-wordpress-database-queries/
For this one, can you try contacting your hosting service? Moreover, can you also try doing the steps provided in the link above and see if they could also help?
Hope this helps! 🙂
February 4, 2022 at 2:11 am #2104811pairfum
Hi Ferando,
Many thanks for your advice and recommendations. I very much appreciate it.
However, we were looking for your advice on how to fix the specific slow query of GeneratePress that we refer to.
If a slow server was the cause, then it would affect all other queries as well and it doesn’t.
Hence, we would very much appreciate your advice on how to fix the slow query we refer to in our screenshot.
Kind regards,
Pairfum London
February 4, 2022 at 3:59 am #2104921Fernando Customer Support
Considering that your page loads multiple queries, it makes sense that one or two of them would in turn become slow since the page would be trying to communicate with the database server multiple times.
In terms of this specific query in the screenshot, it would be best to lessen the scope of the query.
Moreover, it would also be advisable to implement Object Caching, and if possible, lessen the queries implemented in this specific page.
Here is an article regarding Object Caching: https://wp-rocket.me/blog/object-caching-use-wordpress/#:~:text=I%20Want%20This!-,So%20What%20is%20Object%20Caching%3F,-Object%20caching%20involves
Hope I was able to answer your inquiry!
February 4, 2022 at 5:50 am #2105021pairfum
Dear Fernando,
Many thanks for your reply.
I have forwarded your suggestion to our hosting company and this is there response:
Hello,Good day to you!
LiteSpeed lets you use object caching. For most sites on our system object caching doesn’t meaningfully improve performance and it adds complexity, there can be oddities in how the admin works/etc when it is active. Due to this we haven’t enabled object caching by default across all sites.
We can offer object caching via APCu, however. This works well but is only typically helpful for large/complex e-commerce or membership sites. That can vary and we often at least test-implement it on sites seeing performance problems. But for the average site on our system we don’t see a significant benefit and generally recommend skipping object caching unless there is an issue it is needed to address.
You can enable APCu via Cpanel–>Select PHP Version–>Select Extensions–>You can select apcu option.
Feel free to contact us back if you need further assistance.
Regards
Reading this reply, it seems to us that Object Cache won’t be the solution.
Is there nothing that can be done within Generate Press?
It seems quite odd that this slow query needs to check so many page IDs. Is there something that can be simplified?
Kind regards,
Pairfum London
February 4, 2022 at 8:24 pm #2105861Tom
Lead DeveloperLead DeveloperHi there,
It’s hard to tell exactly where that query is coming from looking at the screenshot.
Does it disappear if you remove the site logo or mobile header logo (if you’re using it?).
February 7, 2022 at 4:12 am #2107969pairfum
Hi Tom,
Many thanks for the reply.
I removed the mobile logo and it does seem to remove one query but the time of the really slow query hasn’t changed much.
Here are screen shots of the parent theme and PG premium:
https://i.imgur.com/ay8zWXv.png
https://i.imgur.com/xdFXbCW.png
https://i.imgur.com/2RlZLWm.pngWhen I also remove the main site logo, the speed of the slow query doesn’t change much:
https://i.imgur.com/6ia5KmX.png
https://i.imgur.com/sF0faNS.png
https://i.imgur.com/bmJqMc8.pngIn other words, it doesn’t look like the site logo is the cause.
It really is quite surprising how fast the other queries are compared with this one, slow query.
Many thanks for your continued help with this.
With kind regards,
Pairfum London
February 7, 2022 at 4:31 am #2107987pairfum
Hi Tom,
We have also tried ‘use navigation as header’ but it does not seem to make any difference to the speed of the query:
https://i.imgur.com/P5rtHJr.png
https://i.imgur.com/zeTwh4M.png
https://i.imgur.com/IU45OUu.pngWith kind regards,
Pairfum London
February 7, 2022 at 11:12 am #2108618Tom
Lead DeveloperLead DeveloperHi there,
Looking at the query closer (specifically this screenshot: https://imgur.com/HYKKjct), it looks like the problem query is the generation of your menu items. That would explain all of the IDs (each menu item).
If you remove your navigation from the page, does the issue go away?
February 7, 2022 at 11:55 am #2108665pairfum
Hi Tom,
I temporarily removed the navigation using this guide:
https://docs.generatepress.com/article/navigation-location/As you can see in these screen shots, the problem disappears completely:
https://i.imgur.com/ClEAOVJ.png
https://i.imgur.com/yPyWmVo.pngThe slowest query is now the logo. The other queries are amazingly fast.
Could our Mega Menu be the cause? We use the GP Mega Menu on our site:
https://docs.generatepress.com/article/building-simple-mega-menu/What solution would you suggest?
Kind regards,
Pairfum London
February 7, 2022 at 12:19 pm #2108689Tom
Lead DeveloperLead DeveloperIt could be, you’d have to test with and without it to know for sure.
The WordPress menu system is known for having some performance issues, but it’s not really something you have a ton of control over. There are solutions out there for caching the menu system, but they all have drawbacks.
The only thing I can suggest is to keep your menu as simple as possible. The more menu items you add the more performance will be affected.
February 7, 2022 at 12:32 pm #2108712pairfum
Hi Tom,
Many thanks for the explanation and word of caution.
We only see the number of items growing in our Mega Menu.
Would a solution be to use a Mega Menu plugin instead, e.g. Max Mega Menu?
Kind regards,
Pairfum London
February 7, 2022 at 8:16 pm #2108951Tom
Lead DeveloperLead DeveloperI doubt that would make a difference unless it doesn’t use the WordPress menu builder.
This issue is likely something you need to live with unless you build a static (non-dynamic) menu, or find a caching system that doesn’t conflict with the other aspects of your site.
February 8, 2022 at 7:44 am #2109444pairfum
Many thanks, Tom, for the advice.
Kind regards,
Pairfum London
February 8, 2022 at 8:48 pm #2110217Tom
Lead DeveloperLead DeveloperNo problem!
-
AuthorPosts
- You must be logged in to reply to this topic.