即使使用行缓存,Cassandra读取延迟也很高,为什么?

时间:2013-06-27 07:03:22

标签: performance cassandra

我正在用简单的模型测试cassandra性能。

CREATE TABLE "NoCache" (
  key ascii,
  column1 ascii,
  value ascii,
  PRIMARY KEY (key, column1)
) WITH COMPACT STORAGE AND
  bloom_filter_fp_chance=0.010000 AND
  caching='ALL' AND
  comment='' AND
  dclocal_read_repair_chance=0.000000 AND
  gc_grace_seconds=864000 AND
  read_repair_chance=0.100000 AND
  replicate_on_write='true' AND
  populate_io_cache_on_flush='false' AND
  compaction={'class': 'SizeTieredCompactionStrategy'} AND
  compression={'sstable_compression': 'SnappyCompressor'};

我使用pycassa,get / xget function()获取100行的行键。但在服务器中获取大约15ms的读取延迟。

colums=COL_FAM.get(row_key, column_count=100)

nodetool cfstats

            Column Family: NoCache
            SSTable count: 1
            Space used (live): 103756053
            Space used (total): 103756053
            Number of Keys (estimate): 128
            Memtable Columns Count: 0
            Memtable Data Size: 0
            Memtable Switch Count: 0
            Read Count: 20
            Read Latency: 15.717 ms.
            Write Count: 0
            Write Latency: NaN ms.
            Pending Tasks: 0
            Bloom Filter False Positives: 0
            Bloom Filter False Ratio: 0.00000
            Bloom Filter Space Used: 976
            Compacted row minimum size: 4769
            Compacted row maximum size: 557074610
            Compacted row mean size: 87979499

这种类型的延迟是惊人的!当 nodetool info 显示读取直接在行缓存中命中时。

Row Cache        : size 4834713 (bytes), capacity 67108864 (bytes), 35 hits, 38 requests, 1.000 recent hit rate, 0 save period in seconds

有谁能告诉我为什么cassandra在从行缓存中读取时会花费这么多时间?

1 个答案:

答案 0 :(得分:2)

启用跟踪并查看其正在执行的操作。 http://www.datastax.com/dev/blog/tracing-in-cassandra-1-2