【发布时间】:2013-05-13 18:36:22
【问题描述】:
我们最近开始在生产中使用 Cassandra 数据库。我们有一个single cross colo cluster of 24 nodes,意思是12 nodes in PHX和12 nodes in SLC colo。我们有一个replication factor of 4,意思是2 copies will be there in each datacenter。
以下是我们的Production DBA's 创建keyspace 和column families 的方式。
使用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.Murmur3Partitioner,同时启用了KeyCaching、SizeTieredCompactionStrategy 和Virtual 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 中维护行缓存非常昂贵,因此建议行缓存用于较少的行数,例如
有什么方法可以验证密钥缓存在我的情况下是否正常工作?
这是我在显示列族架构时得到的结果-
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'};
为了获得良好的读取性能,我应该做些什么改变吗?
【问题讨论】:
-
你的复制因子是 2。
-
'nodetool cfstats' 将显示键缓存命中率
-
rf 为 4。但每个数据中心为 2。
-
可以改用SSD吗?还可以启用键缓存,并监控命中率,以获得 > 80% 的良好性能。我们使用 7 个节点 32GB RAM、关键缓存命中率 ~=80% 和 ssd 驱动器进行读取延迟 99%