Cassandra - 使用NetworkTopologyStrategy

时间:2015-10-31 17:02:28

标签: cassandra datastax cassandra-2.0 nosql

在跨多个数据中心(位于4个全球位置的DC)的复制因子4的生产密钥空间上使用NetworkTopologyStrategy时出现性能问题。每个DC有3个节点,具有相当不错的硬件(70GB RAM,5TB SSD等)。

相同的密钥空间在使用AWS中的4节点集群的SimpleStrategy中表现良好,但在生产环境中运行相同的查询会导致查询时间不佳(从my_table中选择*在AWS中为6ms,在生产中为271ms)。

表“my_table”(隐私名称已更改)定义为:

CREATE TABLE my_table (
    rec_type text,
    group_id int,
    rec_id timeuuid,
    user_id int,
    content text,
    created_on timestamp,
    PRIMARY KEY ((rec_type, group_id), rec_id)
) WITH bloom_filter_fp_chance = 0.1
AND comment = ''
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 864000
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99.0PERCENTILE'
AND caching = {
    'keys' : 'ALL',
    'rows_per_partition' : 'NONE'
}
AND compression = {
    'sstable_compression' : 'LZ4Compressor'
}
AND compaction = {
    'class' : 'LeveledCompactionStrategy'
};

这是一个新创建的生产表,偶尔会有更新和低墓碑数。

查询跟踪如下:

enter image description here

看起来范围请求花费了大量时间。延迟的原因是什么?

同一DC中节点之间的网络延迟<1ms,DC之间的延迟约为50-60ms。

编辑:

以下是select * from my_table的查询跟踪,其中rec_type ='abc'和group = 1 LIMIT 300查询(2个截图因为跟踪太长):

enter image description here

enter image description here

0 个答案:

没有答案