Home Forums WoodMart support forum Site Crashing when getting traffic

Site Crashing when getting traffic

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #103590

    mark-aaron
    Participant

    My 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.
    #103594

    mark-aaron
    Participant

    So, 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.
    #103596

    mark-aaron
    Participant

    Okay, 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.
    #103598

    mark-aaron
    Participant

    So 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_image

    #103599

    mark-aaron
    Participant

    yes 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.

    #103616

    Artem Temos
    Keymaster

    Hi,

    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 theme

    add_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

    #103621

    mark-aaron
    Participant

    My 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.

    #103622

    Artem Temos
    Keymaster

    Have you added the code we sent you?

    #103624

    mark-aaron
    Participant

    Yes I have just implemented it

    Thanks. I will see if it makes an improvement

    #103644

    mark-aaron
    Participant

    So, 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.
    #103654

    Artem Temos
    Keymaster

    This screenshot indicates WordPress function, it is not overridden by our theme.

    #103691

    mark-aaron
    Participant

    But does that mean the function code above isnt working too?

    #103710

    Artem Temos
    Keymaster

    The 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.

Viewing 13 posts - 1 through 13 (of 13 total)