我们最近开始在生产中使用 Cassandra 数据库。我们有一个single cross colo cluster of 24 nodes意义12 nodes in PHX和12 nodes in SLC colo。我们有一个replication factor of 4which 的意思2 copies will be there in each datacenter。
以下是我们keyspace的.column familiesProduction DBA's
使用 placement_strategy = 'org.apache.cassandra.locator.NetworkTopologyStrategy' 和 strategy_options = {slc:2,phx:2} 创建键空间配置文件;
create column family PROFILE_USER with key_validation_class = 'UTF8Type' and comparator = 'UTF8Type' and default_validation_class = 'UTF8Type' and gc_grace = 86400;
我们正在运行Cassandra 1.2.2,它也有、org.apache.cassandra.dht.Murmur3Partitionerwith和enabled 。KeyCachingSizeTieredCompactionStrategyVirtual Nodes
Cassandra 生产节点的机器规格-
16 cores, 32 threads
128GB RAM
4 x 600GB SAS in Raid 10, 1.1TB usable
2 x 10GbaseT NIC, one usable
下面是我得到的结果。
Read Latency(95th Percentile) Number of Threads Duration the program was running(in minutes) Throughput(requests/seconds) Total number of id's requested Total number of columns requested
9 milliseconds 10 30 1977 3558701 65815867
我不确定我应该与 Cassandra 一起尝试哪些其他事情来变得更好read performance。我假设它在我的情况下击中磁盘。我应该尝试将复制因子增加到更高的数字吗?还有什么建议吗?
我相信与 SSD 相比,从 HDD 读取数据大约需要 6-12 毫秒?在我的情况下,每次我猜测它都会撞击磁盘并且启用密钥缓存在这里无法正常工作。我无法启用 RowCache,因为使用 OS 页面缓存更有效。在 JVM 中维护行缓存非常昂贵,因此建议行缓存仅用于较少的行数,例如 <100K 行。
有什么方法可以验证密钥缓存在我的情况下是否正常工作?
这就是我在显示列族模式时得到的结果-
create column PROFILE
with column_type = 'Standard'
and comparator = 'UTF8Type'
and default_validation_class = 'UTF8Type'
and key_validation_class = 'UTF8Type'
and read_repair_chance = 0.1
and dclocal_read_repair_chance = 0.0
and populate_io_cache_on_flush = false
and gc_grace = 86400
and min_compaction_threshold = 4
and max_compaction_threshold = 32
and replicate_on_write = true
and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
and caching = 'KEYS_ONLY'
and compression_options = {'sstable_compression' : 'org.apache.cassandra.io.compress.SnappyCompressor'};
我应该做些什么来获得良好的读取性能吗?