Scaling WooCommerce
-
Upload
patrick-garman -
Category
Internet
-
view
618 -
download
0
Transcript of Scaling WooCommerce
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
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
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
Deployed code combining 29 wp_postmeta inserts into 3 SQL queries https://core.trac.wordpress.org/ticket/34848
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() )
) ) );
wp_postmeta grows exponentially
meta_value is not indexed
Inefficient QueriesSELECT wp_posts.IDFROM wp_posts INNER JOIN wp_postmetaON ( 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.IDORDER BY wp_posts.post_date DESCLIMIT 0, 15