What the Cache?!
summary
Claims that Rails with MySQL can survive half a billion requests per day by avoiding queries and layering caches, and shows concrete tactics: versioned cache keys with an integer stored in memcached, staggered or stale-serving TTLs so one process refreshes while others serve the old value, using messaging (MessagePack) instead of Marshal to cut marshaling CPU and size, and adding a local LRU cache per process to avoid repeated deserialization. Implements a memcached lock/flag to prevent stampedes and reports it working in production.
AI-written summary · about
chapters (16)
- 0:00Introduction
- 1:25Mobile ad tech caching challenges
- 3:11Caching for user experience
- 5:21Cache stampede problem
- 7:11Cache invalidation overload
- 10:11Solutions for stampede
- 12:46Short TTL caching
- 14:30Cache entry versioning
- 17:26Serialization performance
- 19:41Benchmarking formats
- 21:35Version numbers in cache
- 22:59Local in-process caching
- 24:53Implementing LRU cache
- 27:28Cross-process invalidation
- 29:41Using memcache for inter-process communication
- 31:12Final solution results
related talks
10mHigh Perfmance Caching with Rails
31mSolid Cache: A disk backed Rails cache
36mCache is King
37mCache is King: Get the Most Bang for Your Buck From Ruby
30mCaching Without Marshal
24mFrom Expensive Queries to Smart Caching: A DBA’s Guide for Rails
25mCaching strategies on https://dev.to
43mCaching half a billion user transactions
