© 2019 Strange Loop
Cache: it's a lifesaver. How else are you going to serve bucketloads of data, quickly? But caching data comes with its own problems. How do you balance availability against correctness, when you need to worry about cross-data-center consistency, unreliable underlying data stores, or race conditions in your request path? In this talk, I'll start with an overview of naive caching strategies, the problems they solve, and the ways they can backfire, including real stories from production experience with services-based architectures.
Then, I'll discuss a relatively simple augmentation to existing cache strategies - dynamically scaled TTLs - that can defend you against inconsistent cached data. By scaling our cache TTLs based on confidence values, my team dramatically reduced our cache inconsistency rate, even in the face of slow backing stores and competing cross-data-center writes. We'll also cover the abstractions we use to make working with these values simple from the service implementer's perspective. Whether you have a finely-tuned caching strategy and want to compare notes, or if you're just starting to think about how to improve your use of caching, attendees should be able to take away immediately applicable practices from this talk.
These approaches are based on the work of the User Service team at Twitter, which handles millions of per-second operations for all read & write traffic associated with user data.