• Resolved jasonvtp

    (@jasonvtp)


    Hi,

    On average Place order ?wc-ajax=checkout takes about 15-20 seconds. There was an one off case where I’ve seen it done in 3 seconds. This is surprisingly slow, is this common?

    On average Add to Cart ?wc-ajax=add_to_cart seems fine, takes about 1-2 seconds. But 1/10 times it’ll take close to 10 seconds.

    These results were gathered from a brand new instance of WordPress. I only added Woocommerce and went through the basic Woocommerce store setup. So the store is using Storefront theme and has dummy products from the setup process. Nothing else was installed.

    I’ve tried 2 different servers. 1 was Digital Ocean server managed by Cloudways which cost $10. The other was a $40 Optimized Droplet from Digital Ocean (using the WordPress Image). Surprisingly the results from the two were very similar. I was hoping to see a speed improvement in the higher end server but that was not the case. I’m curious to what the limitation could be, since I thought faster CPU and more RAM could help.

    I’m running WordPress Version: 4.9.4 and Woocommerce Version: 3.2.6.

    Are the results above expected or could there be something weird be happening? What can I do to speed things up? Is there a more specialized host I should try? Any special server configs? The store is pretty much empty and I’m the only one testing it. I’m scared to think what might happen later when there are a lot of products, plugins, customers, etc.

    Any help is appreciated. Thanks,

    Jason

Viewing 11 replies - 1 through 11 (of 11 total)
  • Linda

    (@lindamork)

    Automattic Happiness Engineer

    Hi Jason,

    Hosting does make a difference, but it’s more than just a faster CPU and RAM. For example, the minimum recommended PHP version for WooCommerce is 7.x – you can learn more about server requirements here: https://docs.woocommerce.com/document/server-requirements/

    You may also find some helpful tips on why your site is slow here:
    https://docs.woocommerce.com/document/troubleshooting-a-slow-site/

    You also might consider updating to the current version of WooCommerce which is 3.3.3

    Hope this helps!

    Hello Jasonvpt,

    have you come to a conclusion?

    Having cloud hosting as well php 7.28. opcache, nginx fcgi etc. it is of course not a hosting capability issue whatsoever or a woocommerce version (3.4.3)
    As to wordpress I looked everywhere, i managed sometimes to have 2 seconds only.
    Then a while later, with nothing changed it is also 20 seconds TTFB ?wc-ajax=checkout again in woocommerce checkout. It is this variance with its tendency to be stuck more often than not at 20 seconds.
    I ruled out mail sending plugins, cloudflare, themes and all the other plugins. It does not seem to have an impact significantly.

    how to debug and trace that behaviour?
    regards
    Marco

    • This reply was modified 6 years, 3 months ago by marcopolo8888.
    Thread Starter jasonvtp

    (@jasonvtp)

    Hi Marco,

    This issue still occurs occasionally and we are unsure why. We might need to hire a contractor to come take a look to help speed it up.

    Maybe you can try php profiling with xdebug and cachegrind. That might give you some more insight into whats going on. https://www.slideshare.net/ottokekalainen/improving-wordpress-performance-with-xdebug-and-php-profiling

    Also might be good to look at your active plugins and see how they use php sessions. Using sessions can create locks which might slow the checkout process. https://pressjitsu.com/blog/wordpress-sessions-performance/

    Best,

    Jason

    Hello Jason,
    thanks for coming back.
    In the meanwhile I had heavily logged microtimes and tracked woocommerce status and save functions. trying to backtrace in runtime does not work with POST requests like ?wc-ajax=checkout.
    That led to isolating the delay to
    do_action( 'wp_insert_comment', $id, $comment );
    Commenting this hook in the core file /wp-includes/comment.php eliminated the delay right away, but no order email either.
    ok finding the actions hooking into “wp_insert_comment” is best done with ssh in wordpress root:
    grep -Ril "add_action( 'wp_insert_comment" *

    result:

    wp-content/plugins/woocommerce/includes/class-wc-comments.php
    wp-content/plugins/sitepress-multilingual-cms-master/inc/translation-management/translation-management.class.php
    wp-content/plugins/nginx-helper/nginx-helper.php

    first one commented and checked out out, still 20 sec
    second add_action commented and checked out out, still 20 sec
    in third files the same commented and checked out in only 642ms !

    ok identified the source, but commenting out permanently does not makes sense

    			if (!strpos($_SERVER['REQUEST_URI'], "checkout")) 
    			{
    				add_action( 'wp_insert_comment', array( &$rt_wp_nginx_purger, 'purgePostOnComment' ), 200, 2 );
    			
    				add_action( 'transition_comment_status', array( &$rt_wp_nginx_purger, 'purgePostOnCommentChange' ), 200, 3 );
    			}

    added the condition just for this checkout use case, so that comments somewhere else still get purged

    my guess is, i could be wrong
    as the woocommerce save order normally adds an order comment the purge mechanism is called, however as this is backend wp-admin, no cache is created anyway
    my guess is that nginx cannot find any comment to purge in fastcgi and therefore (wild guess) takes a long time until the search times out after 17-18 sec or so.

    Jason, if you dont use this nginx helper then just use the grep command to find the plugin.
    Hope this helps

    sure would not make sense to see this timeout caused in my case by nginx purging in another plugin.

    Thread Starter jasonvtp

    (@jasonvtp)

    Hi Marco,

    Thanks for sharing. We are not using nginx-helper so it’s probably something else. Also did a quick search but it doesn’t seem like any of plugins purges the cache on the action hook wp_insert_comment. Maybe a different hook is causing our cache to purge and block/slow down something? Will need to investigate that path.

    We’ll probably have to spend a good day or two and log the execution time of everything during checkout and see what plugins are conflicting with each other. However, I think when we tested this before creating this topic there was just the basic woocommerce plugins. Has been a while..

    Thanks again.

    We have a similar issue. The site works fast except when completing checkout for orders that use a 100% discount coupon.

    When paying with Paypal or Stripe it’s reasonably fast, but for some reason, when using a free coupon the order completion can take up to 20 seconds.

    How do you debug this? Query Monitor doesn’t track this ajax call.

    Thread Starter jasonvtp

    (@jasonvtp)

    Hi fariazz,

    Maybe php slow logs can help you out. Once you set it up you will be able to see all the slow running processes as it happens. Here is a post on how to set it up (lots out there).
    https://support.hypernode.com/knowledgebase/spot-slow-extensions-using-phps-slow-log/

    Also try the xdebug and cachegrind method mentioned above as well.

    Hope this helps,

    Jason

    Hello
    I have same problem
    ?wc-ajax=checkout load toooo SLOWWWWW. Near 60 seconds.
    I tried disable all plugins (except Woocommerce) – ?wc-ajax=checkout still slow.
    I tried change theme – ?wc-ajax=checkout still slow.
    Someone could solve this problem in his? What helped you?

    I had the same problem. What solved was installing and activating the WP Fastest Cache Plugin. Didn’t even change anything in settings (no box checked). This solved the issue for me.

    Thread Starter jasonvtp

    (@jasonvtp)

    Hi @luizguilherme77,

    I’ved tried it in the past for this problem but no luck (for me at least). The WP Fastest Cache Plugin helps with page load speeds by bundling and minifying your JS/CSS, and generating static your code for your HTML. They also have other nice features. But the problem (I was experiencing) was the execution time of some code or database queries at the time of checkout which I don’t believe WP Fastest Cache Plugin will help solve.

    I had tried to look at some other caching solutions that will help with php performance such as wp opcache but also no luck there as well.

    Best,

    Jason

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Checkout is Slow’ is closed to new replies.