https://slatedb.io logo
Reading: https://engineering.fb.com/2013/10/09/cor...
# general
> 2MB segments from overall storage were linearly mapped to the cache. However, this architecture resulted in hot tables being collocated in the same cache sets and colder tables occupying other sets that were mostly idle
So, one drawback of flash cache is it requires maintaining a cache index
> For each cached block, a descriptor is maintained that holds information such as the time of last access, dirty status (indicating if the block has been modified and not yet written back to the backing storage), and possibly the size of the block.
https://github.com/facebookarchive/flashcache/blob/master/doc/flashcache-doc.txt: > The cache is structured as a set associative hash, where the cache is > divided up into a number of fixed size sets (buckets) with linear > probing within a set to find blocks. The set associative hash has a > number of advantages (called out in sections below) and works very > well in practice.
This is essentially how I had been thinking a block cache for slate would work. I had also been thinking it might make sense to combine with the in-memory cache that we have
Could essentially save evictions from the in-memory cache into a buffer. When buffer is full, flush it to disk.
Moka has an eviction listener too
> An allocate request is fulfilled by allocating space in > DRAM, evicting Items from DRAM if necessary. Evicted > Items are either admitted to a flash cache (potentially causing another eviction) or discarded.
> CacheLib’s DRAM cache uses a chained hash > table to perform lookups. The DRAM cache can be partitioned into separate pools, each with its own eviction policy. Programmers select a particular PoolId when calling > allocate (see Figure 7), allowing the isolation of different > types of traffic within a single cache instance.
2 Views