Latency by Pekka Enberg #booksummary
Caching

Latency by Pekka Enberg #booksummary Caching

  • Caching is a technique for speeding up data retrieval by storing temporary copies of data closer to where it’s accessed, similar to colocation or replication but with different trade-offs. The primary goal of caching is to reduce the latency and complexity involved in data access.
  • Different caching strategies, cache-aside, read-through, write-through, and write-behind caching, vary in how the cache integrates with the backing store. The various strategies have different trade-offs between latency and complexity because of how they deal with reading and writing.
  • In many applications, you end up using distributed caching, meaning multiple copies of the cache exist. This indicates that you need to deal with cache coherency in the cache unless your application can cope with cache incoherency.
  • Maximizing the hit ratio of your cache is the key to uncovering low-latency access. Different cache replacement policies such as LRU, LFU, and FIFO mandate that entries are evicted from a cache when fully occupied, impacting the hit ratio.
  • Time-to-live (TTL) is a way to deal with data freshness in a cache by specifying how long an entry can be considered valid in a cache until it has to be retrieved again from the backing store. However, TTL is often tricky to get right and can result in a low cache hit ratio if TTL is too low or an application reading stale data if TTL is too high.
  • Materialized views is a technique to speed up database queries by building a copy of the data, organized in views, which can be queried like database tables when constructed.
  • Memoization is a technique to cache the results of computation. Although the term comes from dynamic programming, an everyday use of memoization is to cache the results of REST API calls, which often combine computation and data access.

#latency

Credits : Manning

To view or add a comment, sign in

More articles by Pankaj Gajjar

Insights from the community

Others also viewed

Explore topics