On 7/28/10 12:26 PM, YES Linux wrote:
i was wondering what the trade offs were between the key cache and row
cache?  which is more important from a read?  if you have a large row
cache can your key cache be small?

- The row cache is a superset of the key cache. If you have a row cache on a CF, you probably do not want a key cache as well.

- The row cache caches entire rows. In order to do that, it has to deserialize the row first. If you are only reading a single column from that row, the entire row will be cached anyway. The key cache doesn't have to deserialize the row.

- A single wide row might evict many narrow rows from the row cache. In many designs, the variance of key lengths is smaller than variance in row sizes. Keys are usually smaller than rows, which means you can cache more of them in the same memory. Of course you "win" less, because you still have to seek to the row data on disk.

Which type of cache is appropriate to your particular case depends on a variety of factors including the hotness and other access characteristics of your data set, the relationship of data set size to the heap size, row size to key size, and so forth.

=Rob

Reply via email to