Migrating Shopify’s Core Rails Monolith to Trilogy
summary
Shopify migrates its Rails monolith from mysql2 to Trilogy, implements multi-statement support and a com_set_option path in the C API, and updates the ActiveRecord adapter to iterate results (abandoned results not available). Rollout uses a 1% rollout then a 50% ramp that triggers proxySQL churn until adding the missing CLIENT_MULTI_RESULTS flag fixes it. Production shows ~22% faster request latency and ~17% faster query time, and the adapter is upstreamed into Rails 7.1.
AI-written summary · about
chapters (12)
- 0:00Trilogy migration at Shopify
- 2:25Trilogy database client overview
- 7:29Why switch to Trilogy
- 9:14MySQL protocol explained
- 13:07Multi-statement support in Rails
- 15:53Implementing multi-statement
- 21:50ActiveRecord adapter changes
- 23:15Code migration MySQL 2 to Trilogy
- 28:17Safe production deployment
- 31:47Debugging rollout failure
- 34:15100% production rollout
- 36:20Trilogy results and future
related talks
29mMigrating Shopify’s Core Rails Monolith to Trilogy
39mScaling Shopify's Multi-Tenant Architecture across Multiple Datacenters
29mScaling Rails to 2M MySQL requests per second
39mZero-Downtime Rebalancing and Data Migration of a Mature Multi-Shard Platform
41mKeynote: Technically, a Talk
56mScaling Rails API to Write-Heavy Traffic
39mPostgres & Rails 6 Multi-DB: Pitfalls, Patterns, Performance
14mDatabase Performance at Scale for RoR Applications
