where is your data cached?
DESCRIPTION
Taking a look at the many layers of caching in the modern webstack can lead to some interesting optimizations. We know that raid card caches, disk caches and CPU caches all exist at the hardware level, but how do they interact with database caching, application code caching and rendered page caching. Where are the redundancies and where is the most optimal location for your services to cache? Are you risking data integrity by using both disk and raid card caching? Is there a similar risk in using both filesystem and database caching? These are hard won lessons if you have to learn them during an outage. they can be avoided with some forethought and benchmarking. I’ll call out the many layers where data is cached and talk about some of the risks and potential performance gains that we’ve found by selectively disabling and adding particular caching layers.TRANSCRIPT
![Page 2: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/2.jpg)
①why do we cache?②count them③which are redundant?④which are a risk?⑤benchmarking ⑥monitoring
![Page 3: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/3.jpg)
①why do we cache
cache: a component that transparently stores data so that future requests for that data can be served faster
![Page 4: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/4.jpg)
CPU caches (L1, L2, L3)
disk caches
disk controller caches
database caches
memcached layer
application code caches
http cache
edge cache or CDN
operating system caches
② count them
![Page 5: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/5.jpg)
and then there were more
DNS caching (ISP and client side)
web proxies
client side application caches
and all the hardware caching again
![Page 6: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/6.jpg)
a short diversion:
my background is as an SA and DBA. i’ll be focusing data safety facets of caching
![Page 7: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/7.jpg)
![Page 8: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/8.jpg)
disk caches
disk controller caches
database caches
memcached layer
operating system caches
![Page 9: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/9.jpg)
③which are redundant?
![Page 10: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/10.jpg)
get moving!
![Page 11: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/11.jpg)
![Page 12: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/12.jpg)
④which are a risk?
![Page 13: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/13.jpg)
disks lie
![Page 14: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/14.jpg)
raid controllers lie (sometimes)
![Page 15: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/15.jpg)
![Page 16: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/16.jpg)
⑤ benchmarking
![Page 17: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/17.jpg)
![Page 18: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/18.jpg)
every infrastructure is different
every benchmarkhas to take that intoaccount
![Page 19: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/19.jpg)
![Page 20: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/20.jpg)
⑥ monitoring
![Page 21: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/21.jpg)
measure multiple points
only you can preventfiredrills
![Page 22: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/22.jpg)
![Page 23: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/23.jpg)
tools to managethis insanity—
InnotopPercona toolkitsysbenchcacti templatesnagios
![Page 24: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/24.jpg)
credits
flickr
• license plate – severud• tools – meanestindian
other
• 3ware image via http://www.xbitlabs.com/
• remaining images istockphoto
![Page 25: where is your data cached?](https://reader033.vdocument.in/reader033/viewer/2022052900/5562e95ed8b42ad26c8b4ef0/html5/thumbnails/25.jpg)
CIO Meteor EntertainmentProgram Chair OSCONProgram Chair PLMCEBoard Member Blue Gecko
Chef CommunityMySQL Community
[email protected]@sarahnovotny
stuff I do