cassandra如何使用memtable处理更新

问题描述 投票:0回答:2

在压缩期间,如果我们有两个或更多版本的同一行,Cassandra只会将最新版本写入新的SSTable。在读取过程中,如果一行在SSTable上有多个版本,则进行比较。

1.当行只在memtable(尚未刷新)时,会发生同样的事情吗? 2. Cassandra如何处理尚未刷新到SSTable的行的多个更新。 3.从memtable vs SSTables读取记录(有多个版本)对性能有影响吗? 4.我有一个应用程序仅在其输入的前5分钟内频繁更新一行(10次)的情况。当行处于memtable(尚未刷新)时,可能会发生这种情况。处理这个问题的首选方法是什么?

很抱歉有多个问题。

cassandra datastax datastax-enterprise
2个回答
0
投票
  1. 只有最后一次更新保留在内存中
  2. 内存总是比磁盘上更快
  3. 不要指望memtable能够在内存中保留多个变化。

0
投票

要获得答案,您需要了解Cassandra如何读取和写入数据。阅读此链接以查找详细信息.How Cassandra reads and writes data

1.当行只在memtable(尚未刷新)时,会发生同样的事情吗?

不会。它会替换更新相同密钥时的现有值。

2. Cassandra如何处理尚未刷新到SSTable的行的多个更新。

When a write occurs, Cassandra stores the data in a memory structure called memtable, and to provide configurable durability, it also appends writes to the commit log on disk. The commit log receives every write made to a Cassandra node, and these durable writes survive permanently even if power fails on a node. The memtable is a write-back cache of data partitions that Cassandra looks up by key. The memtable stores writes in sorted order until reaching a configurable limit, and then is flushed.

3.从memtable vs SSTables读取记录(有多个版本)对性能有影响吗?

很明显,memtable访问比多版本sstable访问更快

4.我有一个应用程序仅在其输入的前5分钟内频繁更新一行(10次)的情况。当行处于memtable(尚未刷新)时,可能会发生这种情况。处理这个问题的首选方法是什么?

如果启用行缓存会更好。此外,您可以增加memtablecommit log大小,以获得最佳性能。

链接:Configuring data caches

© www.soinside.com 2019 - 2024. All rights reserved.