educative.io

Educative

Key cache may slow down writes?

In “Anatomy of Cassandra’s Read Operation”:

Key cache: Key cache stores a map of recently read partition keys to their SSTable offsets. This facilitates faster read access into SSTables stored on disk and improves the read performance but could slow down the writes, as we have to update the Key cache for every write.

The key cache is all about SSTable offsets. If the Memtable flush is asynchronous, then updating key cache does not slow down the write operation I guess? It may slow dow the flush operation, but client will never see that.

Right, key cache is not involved in the write path. We misquoted it here; during a write operation, we have to invalidate only the row cache and not the key cache.

The impact of Key cache on the write operation can only be considered in terms of memory usage. If key cache is taking a lot of memory, we will have less memory for other operations and MemTable. Having said that, since Key cache takes little memory compared to row cache (where the whole row is stored in memory), it provides considerable rewards for a small memory usage.

1 Like

Thanks, that is very clear now.