Cassandra中rowcached对性能的影响

一直对cassandra做测试,但是测试的结果却跟官方提供的写快,读慢的情况相反。一直没找到问题的答案。

最近在做大数据量的测试时才想起了conf/storage-conf.xml中的这个字段rowcached:
       ~ The optional RowsCached attribute specifies the number of rows
       ~ whose entire contents we cache in memory. Do not use this on
       ~ ColumnFamilies with large rows, or ColumnFamilies with high write:read
       ~ ratios. Specify a fraction (value less than 1), a percentage (ending in
       ~ a % sign) or an absolute number of rows to cache. 
       ~ RowsCached defaults to 0, i.e., row cache is off by default.

意思大概是有多少row的数据会放到内存中而不是写入到文件中。

将该值设置为具体的值后测试发现,写的性能明显提升了很大的一块,读的性能也有明显的加快。

所以说官方给出的结果是基于内存的形式做出,即打开了rowcache属性,如果不打开该属性,默认不使用内存的话,即使是使用sstable,性能上也会因为写文件而拖慢。

另外注意磁盘写入的操作,根据业务能容忍的情况合理安排数据,当然还要根据多节点的复制策略进行规划。

你可能感兴趣的:(xml,cache,cassandra)