Get the latest tech news

Analyzing the codebase of Caffeine, a high performance caching library


The other day, while wasting time reading reddit, I stumbled upon a blogpost mentioning S3 FIFO, a method claiming to outperform LRU (Least Recently Used) in terms of cache miss ratio. Notable companies like RedPandas, Rising Wave, and Cloudflare have already implemented it in various capacities, so this piqued my interest. Caches are a pretty darn interesting and at Datadog, we rely heavily on them in several services, so I knew I had to put S3 FIFO to the test, or at least, make sure I understood its core ideas.

The other day, while wasting time reading reddit, I stumbled upon a blogpost mentioning S3 FIFO, a method claiming to outperform LRU (Least Recently Used) in terms of cache miss ratio. It provides awesome features like automatic loading of entries, size-based eviction, statistics, time-based expiration and it is used in a lot of impactful projects like Kafka, Solr, Cassandra, HBase or Neo4j. While there are other intriguing aspects of Caffeine’s internals, such as separate buffers for reads and writes, automatic metrics, and the simulator, I believe we’ve covered enough to grasp its main concepts and inner workings.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of codebase

codebase

Photo of Caffeine

Caffeine

Photo of high performance

high performance

Related news:

News photo

Show HN: Instantly visualize any codebase as an interactive diagram

News photo

DB48X: High Performance Scientific Calculator, Reinvented

News photo

Show HN: LlamaPReview – AI GitHub PR reviewer that learns your codebase