Home › Forums › WoodMart support forum › Site Crashing when getting traffic
Site Crashing when getting traffic
- This topic has 12 replies, 2 voices, and was last updated 6 years, 6 months ago by
Artem Temos.
-
AuthorPosts
-
January 23, 2019 at 10:37 am #103590
mark-aaronParticipantMy site started to get traffic today and has crashed right away. My hosting company is showing lots of slow queries and errors.
Here are the slow transactions we can find, I am checking them one by one:
What I can see is that the woodmart_get_product_thumbnail function here is taking over 30 seconds to load:
In this place we see that the postmeta select query was run 105 times coming in at 41 seconds.
Other than these two I’m not seeing anything else for the moment.
PHP Workers are needed to handle PHP requests. You are on the Enterprise 1 plan which comes with 8 PHP Workers, this means your site can handle 8 PHP requests per second. If a request takes a very long time to be processed, this means other incoming requests cannot be served immediately. This can cause sites to be slower or can result in a timeout error in the worst case.
It looks like your PHP Workers are consistently maxing out. In this case, I would highly suggest that your developer checks these image manipulation functions and why they’re being triggered this often.
Attachments:
You must be logged in to view attached files.January 23, 2019 at 10:38 am #103594
mark-aaronParticipantSo, what I was able to gather just now is that all of this is started inside the woodmart_woocommerce_main_loop function here, this is then loading the function wc_get_template_part 107(!) times, and each of these has a long trail where it queries the database, and inside that, it also seems to be looking for or generating – this is something I am not able to tell here – thumbnail images.
Attachments:
You must be logged in to view attached files.January 23, 2019 at 10:40 am #103596
mark-aaronParticipantOkay, I got something here that’s more helpful. This is always running a regeneration function as you can see. So for every call, images are generated dynamically, this is taking a long time to do which is quite normal. I would suggest you look into how to disable this particular feature:
Attachments:
You must be logged in to view attached files.January 23, 2019 at 10:41 am #103598
mark-aaronParticipantSo the order of functions that are running here is:
woodmart_woocommerce_main_loop
v
120 calls to wc_get_template_part
v
woodmart_template_loop_product_thumbnail
v
woodmart_get_product_thumbnail
v
wp_get_attachment_image_src
v
WC_Regenerate_Images::resize_and_return_imageJanuary 23, 2019 at 10:49 am #103599
mark-aaronParticipantyes the regenerate images, you think that is the issue?
From what we can gather, yes, this is probably the culprit. These functions are run over 100 times per page load, image manipulation is quite resource-heavy and our servers are not configured for these tasks, so this is currently causing all the timeouts as I can see.
January 23, 2019 at 12:08 pm #103616
Artem TemosKeymasterHi,
Images regeneration is a part of the WooCommerce plugin and our them doesn’t influence it. If you will check the code of that function you will see that it just calls default WordPress function https://gyazo.com/63baece02980339a21760d43e2d7d5c6
If you want to deactivate it completely, add the following code to the functions.php in the child themeadd_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 ); remove_action( 'woocommerce_before_shop_loop_item_title', 'woodmart_template_loop_product_thumbnail', 10 );
Regards
January 23, 2019 at 12:19 pm #103621
mark-aaronParticipantMy host company has said this:
What we do see in New Relic is that this actually being called through Woodmart and not from the normal WP Core functions.
January 23, 2019 at 12:20 pm #103622
Artem TemosKeymasterHave you added the code we sent you?
January 23, 2019 at 12:35 pm #103624
mark-aaronParticipantYes I have just implemented it
Thanks. I will see if it makes an improvement
January 23, 2019 at 2:03 pm #103644
mark-aaronParticipantSo, I checked again and the code you were running did not change the output here. This is from 10 minutes ago.
The issue is still crashing the site and overloading the server
Attachments:
You must be logged in to view attached files.January 23, 2019 at 2:42 pm #103654
Artem TemosKeymasterThis screenshot indicates WordPress function, it is not overridden by our theme.
January 23, 2019 at 5:15 pm #103691
mark-aaronParticipantBut does that mean the function code above isnt working too?
January 23, 2019 at 7:28 pm #103710
Artem TemosKeymasterThe code removes our theme functions that you pointed initially. So if the error still appears then it is not caused by our theme. As we said, images are generated and displayed by WooCommerce functions and our theme doesn’t influence it.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register