How Shopify Dynamically Routes Storefront Traffic - Shopify

This post details the evolution of Shopify's storefront traffic routing strategy, specifically focusing on the dynamic routing mechanism implemented using nginx with OpenResty. It describes the transition from static routing rules in Lua files to a dynamic JSON-based rule system managed via a control plane and the 'Spy' chatbot. Key technical contributions include the configuration options for rules (rule_name, filters, shop_ids), traffic distribution rates (render_rate, verify_rate, reverse_verify_rate, self_verify_rate), and the implementation details within nginx's Lua module for rule evaluation and asynchronous verification requests. It also highlights how this dynamic routing system was leveraged for resilience testing and gradual rollouts.
More from the Storefront Rendering Performance trail
- Horizontally scaling the Rails backend of Shop app with Vitess - Shopify
- The Vitality of Core Web Vitals - 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