Horizontally scaling the Rails backend of Shop app with Vitess - Shopify
Jan 17, 2024

Summary
This post details the migration of the Shop app's Rails backend from a monolithic MySQL database to Vitess for horizontal scaling. It covers the challenges of hockey stick growth, the limitations of incremental scaling, and the decision-making process for choosing Vitess. Key technical contributions include re-organizing the data model to include user_id columns, setting up query verifiers (Missing Sharding Key, Cross Database Transaction, Cross Shard Transaction, Cross Shard Write, Cross Keyspace Query) to ensure compatibility with Vitess, and the strategic choice of user_id as the sharding key for a 'users' keyspace, while keeping other data in an unsharded 'global' keyspace.
More from the Storefront Rendering Performance trail
- The Vitality of Core Web Vitals - Shopify
- How Shopify Dynamically Routes Storefront Traffic - Shopify
- Simplify, Batch, and Cache: How We Optimized Server-side Storefront Rendering - Shopify
- How to Do an In-depth Liquid Render Analysis with Theme Inspector - Shopify
- How Shopify Reduced Storefront Response Times with a Rewrite - Shopify