Home Forums Plugins WooCommerce Cart All in One Resource hungry ajax call

Resource hungry ajax call

  • Author
  • #148267


    we lately had a downtime of our servers due to high load during a TV report about our business (such a report happens every now and then).

    While analysing and taking measures to prevent such things in future, one thing which I discovered is a very resource hungry Ajax call from your plugin: ?wc-ajax=viwcaio_get_cart_fragments

    This call takes 700-900ms, while a cached page load takes 50-70ms(!).
    I understand what this call is for, but it does not seem to make much sense to make it even though the cookies clearly show that the particular customer has no item in the cart (or no cart at all).

    Is it possible to somehow prevent the browser making the request in the first place or cache the response in case the cart is empty or for sessions without any cart?

    It is fully ok to live with the call in case someone puts something into the cart but we simply cannot buy enough cores to cope with a low few hundreds of sessions where every click blocks one core for 700-900ms, even though someone is just browsing without using the basket at all.

    WP Rocket provides caching empty cart responses for ?wc-ajax=get_refreshed_fragments (which for whatever reason currently is not working properly why I’m in contact with them as well) and I would love so have some similar logic for your cart plugin as well.

    Otherwise we will never be able to avoid downtimes due to high load if every page load fires a cart ajax request which takes that long even though there is no cart in that particular session.

    Thanks for your help

You must be logged in to see replies to this topic. Click here to login or register