Save 37% off PRO during our Black Friday Sale! »

Patrick Garman - WooCommerce: Scaling in the Way That Matters Most

1885ae854a900f592f0e22e609c0c345?s=47 WooConf
April 06, 2016

Patrick Garman - WooCommerce: Scaling in the Way That Matters Most

Patrick Garman is a Sr. eCommerce Specialist at ColourPop Cosmetics, one of the fastest growing WooCommerce stores around. Formerly a WooCommerce extension developer, WooCommerce Ninja at WooThemes, and a developer at WebDevStudios & Maintainn; altogether giving Patrick a unique set of skills and experience in WooCommerce, product development, enterprise WordPress development, and scaling WooCommerce.

WooCommerce – scaling in the way that matters most

There are three types of volumes that can be defined as scale: traffic, products, and orders. Traffic is great, except when it is not generating sales. Products are great, but who cares about 10,000,000 products if no one is buying them. So how do you deal with a large raw volume of orders within WooCommerce? This is where things get tricky. While volumes of traffic and products can be solved with various methods of caching, you cannot cache the creation of an order.

This talk is going will take you on the rollercoaster ride that is scaling a WooCommerce site experiencing rapid growth on multiple levels, how to accurately gauge the scale of your WooCommerce shop, and how solve the scaling issues that this can create.

1885ae854a900f592f0e22e609c0c345?s=128

WooConf

April 06, 2016
Tweet

Transcript

  1. GARMAN PATRICK 02:00 DEVELOPER TRACK ACL - MAIN HALL NEXT

    WOOCONF2016 WOOCOMMERCE - SCALING IN THE WAY THAT MATTERS MOST DEVELOPER TRACK
  2. Scaling WooCommerce in the way that matters most

  3. Patrick Garman @pmgarman

  4. Yet ANOTHER talk about scaling WordPress

  5. Caching

  6. Lots of Traffic * Assuming very low conversion rate •

    Static cache is your friend • Find a solution for serving logged in visitors cached pages • Remove header/sidebar carts where possible
  7. Lots of Products • Static cache is your friend •

    Paginate or limit customer reviews being shown • Disable “Show verified owner label for customer reviews” option for product reviews • Replace WordPress search
  8. Scaling WooCommerce Changes the Conversation How do you scale a

    high traffic blog? • Full page caches • Object caches • Fragment caches • Cache database queries • Database replication What can’t save you when your site survives a flood of new traffic thanks to caching and they all want to place an order? • Cache What can break WooCommerce in the most glorious way possible? • Replication Lag
  9. Can WooCommerce Scale? Yes * * Not overnight, not without

    careful planning, not without help.
  10. Lots of Orders ?

  11. Coupons

  12. 70,000 The number of times a coupon can be used

    before things break.
  13. wp_postmeta

  14. 38 The number of inserts to wp_postmeta by WooCommerce on

    checkout.
  15. Deployed code combining 29 wp_postmeta inserts into 3 SQL queries

    https://core.trac.wordpress.org/ticket/34848
  16. My Account

  17. ? The number of people who can open the My

    Account page at once.
  18. Inefficient Queries $customer_orders = get_posts( apply_filters( 'woocommerce_my_account_my_orders_query', array( 'numberposts' =>

    $order_count, 'meta_key' => '_customer_user', 'meta_value' => get_current_user_id(), 'post_type' => wc_get_order_types( 'view-orders' ), 'post_status' => array_keys( wc_get_order_statuses() ) ) ) );
  19. wp_postmeta grows exponentially meta_value is not indexed Inefficient Queries SELECT

    wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND ( ( wp_postmeta.meta_key = '_customer_user' AND CAST(wp_postmeta.meta_value AS CHAR) = '1' ) ) AND wp_posts.post_type IN ('shop_order', 'shop_order_refund') AND ((wp_posts.post_status = 'wc-pending' OR wp_posts.post_status = 'wc-processing' OR wp_posts.post_status = 'wc-on-hold' OR wp_posts.post_status = 'wc-completed' OR wp_posts.post_status = 'wc-cancelled' OR wp_posts.post_status = 'wc-refunded' OR wp_posts.post_status = 'wc-failed')) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 15
  20. * Thanks Zach! Perfect Example

  21. March 21, 2016 11:40 AM (CST) https://github.com/garmanio/wc-customer-order-index

  22. Moving Forward With WooCommerce

  23. @pmgarman patrick@garman.io https://pmgarman.me Patrick Garman