Shopify
Shopify logoShopify · Feature trail

ActiveRecord Model Caching

2 posts · Apr 2013 – Sep 2021

What this trail covers

Shopify has evolved its caching mechanisms to improve performance and reduce database load. This includes developing custom write-through caches for high-traffic features like the Shop app's home feed, utilizing Memcached for its simplicity and low overhead. The system handles concurrent updates and ensures cache validity through a pending writes key and short-expiry keys, making changes transparent to developers via Active Record Concerns. Rollout strategies involve phased testing and comparison of cached vs. database data to guarantee correctness. This has led to significant reductions in database load, app latency, and overall CPU usage.

All Shopify trails