Caching Flashcards
T/F: Caching is important in that it helps reduce expensive reads from disk
True
What is a caching layer, and where does it sit in your application pipeline?
It’s typically another fleet of servers that sit in front of your database to store and return common transactions
T/F: Cache servers store data in-memory, increasing speed
True
T/F: Caching layers are most beneficial for applications with more writes than reads
False, caching stores data to be quickly read, so read-centric apps benefit more
What is the cold-start problem when using a cache layer?
If your caching layer goes down and loses its data, it takes time for it to spin back up and regain cached info. Due to the lack of data in the cache, the caching layer would make a ton of expensive read/writes and could crash your DB. Because of this, you need to build into your architecture mitigation strategies, like priming the caching layer with the latest data from your DB before putting it online.
T/F: An expiration policy with caching determines how long data is cached
True
How does the LRU caching eviction policy work?
It evicts the ‘least recently used’ data from the cache when the cache is full
How does the LFU caching eviction policy work?
It evicts the ‘least frequently used’ data from the cache when the cache is full.
How does the FIFO caching eviction policy work?
It evicts the oldest element in the queue, regardless of frequency or recency
What is memcached?
It’s an in-memory key-value caching layer solution that’s open-source and super simple
What is redis?
A caching layer solution that’s much more comprehensive than memcached