行缓存和分区键缓存有什么区别?我是否需要同时使用两者以获得良好的性能视角。
我已经阅读了 dataStax 网站的基本定义
The partition key cache is a cache of the partition index for a Cassandra table. Using the key cache instead of relying on the OS page cache saves CPU time and memory. However, enabling just the key cache results in disk (or OS page cache) activity to actually read the requested data rows.
The row cache is similar to a traditional cache like memcached. When a row is accessed, the entire row is pulled into memory, merging from multiple SSTables if necessary, and cached, so that further reads against that row can be satisfied without hitting disk at all.
任何人都可以详细说明使用领域。确实需要两者都实现。 ?
最佳答案
TL;DR:您想要使用 Key Cache,但很可能不想要行缓存。
key 缓存帮助 C* 了解特定分区在 SStables 中的开始位置。这意味着 C* 不必读取任何内容来确定文件中的正确位置以开始读取行。这对几乎所有用例都有好处,因为它通过潜在地消除读取路径中对 IOP 的需求而大大加快了读取速度。
行缓存有一个更有限的用例。行缓存将整个分区拉入内存。如果该分区的任何部分已被修改,则该行的整个缓存都将失效。对于大分区,这意味着缓存可能会频繁地缓存大块内存并使大块内存失效。因为您确实需要大部分静态分区才能使其有用,所以对于大多数用例,建议您不要使用行缓存。
关于cassandra - Cassandra 行缓存和分区键缓存的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25079311/