Learn about Centmin Mod LEMP Stack today
Become a Member

Wordpress Best Caching Method for Woocommerce sites

Discussion in 'Blogs & CMS usage' started by Fernando, Jun 18, 2019.

  1. Fernando

    Fernando Member

    67
    12
    8
    Jul 21, 2017
    Ratings:
    +23
    Local Time:
    3:01 PM
    1.13.3
    10.1.25
    Hi,

    I'm thinking the best way to cache ecommerce sites using Woocommerce. I know and I understand many things can't be cache.

    I'm in the process of building a market place site so I would expect to have more users logged rather than guest users.

    So looking at Redis using Nginx Helper I see:

    Code:
    # Don't use the cache for logged in users or recent commenters
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|edd_items_in_cart|woocommerce_items_in_cart|woocommerce_cart_hash|woocommerce_recently_viewed|wc_session_cookie_HASH|wp_woocommerce_session_|wptouch_switch_toggle") {
      set $skip_cache 1;
    }
    I understand Centminmod using option 22 uses Redis / KeyCDN however, if I'm not mistaken those are based on full page caching so none of them will work for ecommerce sites, please correct me if I'm wrong.

    So I'm thinking the best option will be to use a Caching Plugin that support full page Cache like KeyCDN or WP Rocket (probably this one) this will work for part of the users that are not logged in and combine it with Redis Object Cache using WP Redis Plugin.

    Is there any other option taking into consideration most of the users will be logged in and using Woocommerce?

    Thank you!
    Best Regards
     
  2. eva2000

    eva2000 Administrator Staff Member

    41,646
    9,380
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +14,408
    Local Time:
    7:01 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    yeah no of the cache plugins would work for logged in users, as those only for guest caching though wordpress super cache reportedly has logged in user support. But never tried it myself so no sure how well it will do. Best to maybe on test VPS server, try all the cache plugin and other options for test wp + woocommerce and see which does best
    wouldn't help that much for logged in users.

    Cloudflare business plan with bypass cache on cookie page rule would be one way if you can afford US$200/month for the plan though to allow guest full page caching Caching Anonymous Page Views and business plan Railgun would accelerate non-cacheable requests i.e. logged in users. I am using this configuration for this forum right now to accelerate both guest + logged in uses :)
     
  3. fabianski

    fabianski Member

    102
    13
    18
    Feb 20, 2019
    Brazil
    Ratings:
    +35
    Local Time:
    6:01 PM
    wp-rocket has an option to cache logged-in users, but I've never tested it with woocommerce.

    If you are going to have lots of products maybe this will help you with a more optimized database liquidweb/woocommerce-custom-orders-table
     
    • Informative Informative x 1
  4. Fernando

    Fernando Member

    67
    12
    8
    Jul 21, 2017
    Ratings:
    +23
    Local Time:
    3:01 PM
    1.13.3
    10.1.25
    Hi,

    Thank you for your suggestions :)

    I though Redis Object Cache using WP Redis Plugin might help :( I believe I will skip it then. I also have seen some issues why modifying things in the backend if enabled.

    @fabianski
    Yes, I never have used wp-rocket with logged in users + woocommerce I will have to test it.

    In regards to a lot of products and search probably I will be using Elastic Search:
    ElasticPress

    Or maybe Redisearch :)
    Search Benchmarking: RediSearch vs. Elasticsearch | Redis Labs
     
  5. fabianski

    fabianski Member

    102
    13
    18
    Feb 20, 2019
    Brazil
    Ratings:
    +35
    Local Time:
    6:01 PM
    RediSearch
     
  6. asperty

    asperty New Member

    9
    9
    3
    Apr 13, 2019
    Ratings:
    +11
    Local Time:
    12:01 AM
    1.17.1
    10.3
    Hi, I have quite a few woocommerce sites on centminmod and use wp rocket for logged in users without any issue. Definitely worth a try
     
    • Like Like x 2
  7. Fernando

    Fernando Member

    67
    12
    8
    Jul 21, 2017
    Ratings:
    +23
    Local Time:
    3:01 PM
    1.13.3
    10.1.25
    Hi,

    Thank you for all the suggestions. I believe I will be using WP Rocket too.

    I believe WP Rocket has nice features.

    I have one more question in regards to WP Rocket. I can think 2 possible ways to implemented:

    #1
    - Use Nginx Level Redis Cache for Guest customers (not logged in). Full Page Cache
    - Once they logged in they will use WP Rocket cache generated for each user

    #2
    - Use WP Rocket Full Page cache for Guest customers (not logged in). Using SatelliteWP/rocket-nginx
    - Once they logged in they will use WP Rocket cache generated for each user

    Just wondering which methods are you using?
    Also, if you are using rocket-nginx how the vhost file looks like in your environment? If you can share it.

    Thank you!
    Best Regards
     
  8. fabianski

    fabianski Member

    102
    13
    18
    Feb 20, 2019
    Brazil
    Ratings:
    +35
    Local Time:
    6:01 PM
    The second option may be better because it will bring you fewer problems (if they exist)

    I use rocket-nginx to serve the cache without going through php, you can see how to configure it here WP Rocket installation on Nginx

    I do not know if for logged in users the cache would be served by php instead of nginx as it happens for unlogged users, you can test and tell us

    And if you try the RediSearch plugin, please tell my your experience
     
    • Informative Informative x 1
  9. asperty

    asperty New Member

    9
    9
    3
    Apr 13, 2019
    Ratings:
    +11
    Local Time:
    12:01 AM
    1.17.1
    10.3
    I would follow @fabianski's advice. His previous posts on the matter really helped me out.

    WP rocket and rocket nginx combo works for not logged in, and wp rocket alone handles logged in users.

    I also used the config mrbo mentions WP Rocket installation on Nginx

    It works for me but only when wordpress permalinks were edited:

    # Wordpress Permalinks
    from
    try_files $uri $uri/ /index.php?q=$uri&$args;

    to
    try_files $uri $uri/ /index.php?$args;

    as per fabianski's post on that thread - @fabianski thanks bro btw.
     
    • Like Like x 2
    • Informative Informative x 1