Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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

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.

WooConf

April 06, 2016
Tweet

More Decks by WooConf

Other Decks in Programming

Transcript

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

    WOOCONF2016 WOOCOMMERCE - SCALING IN THE WAY THAT MATTERS MOST DEVELOPER TRACK
  2. 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
  3. 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
  4. 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
  5. Can WooCommerce Scale? Yes * * Not overnight, not without

    careful planning, not without help.
  6. Deployed code combining 29 wp_postmeta inserts into 3 SQL queries

    https://core.trac.wordpress.org/ticket/34848
  7. 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() ) ) ) );
  8. 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