【发布时间】:2015-04-11 14:38:31
【问题描述】:
我需要将热门客户数据存储在 Cassandra 中。每次客户进行任何活动时,都会在表中插入一个新行。所以这就是我使用SizeTieredCompactionStrategy 的原因。因此,与 leveledcompaction 策略相比,我拥有更少数量的 SSTtable 中的所有数据。
现在,一旦我插入一些测试行并运行以下命令'bin/nodetool compact',以便数据从 memtable 写入 SSTable。之后,我执行 10-15 读取请求。因为我启用了密钥缓存。它应该从缓存中返回数据,除了第一个请求。但正如我在日志中看到的那样,无论我是否从缓存中获取数据,我都看不到任何东西?谁能帮我这个?
此外,在删除键空间和列族之后。为什么我的 data/saved_cache/commitlog 文件夹的大小保持不变。不应该减少吗?
Keyspace and ColumnFamily(Table) Definition :
CREATE KEYSPACE cw WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 3 };
CREATE TABLE cw.usertracking (
Col1 text PRIMARY KEY,
Col2 timestamp,
Col3 text,
Col4 bigint,
Col5 timestamp,
Col6 bigint,
Col7 bigint,
Col8 bigint,
Col9 bigint
) WITH bloom_filter_fp_chance = 0.01
AND caching = '{"keys":"ALL", "rows_per_partition":"10"}'
AND comment = ''
AND compaction = {'min_threshold': '4', 'cold_reads_to_omit': '0.05', 'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32'}
AND compression = {'chunk_length_kb': '64', 'sstable_compression': 'org.apache.cassandra.io.compress.DeflateCompressor'}
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';
追踪日志:
activity | timestamp | source | source_elapsed
--------------------------------------------------------------------------------------------------------+----------------------------+---------------+----------------
Execute CQL3 query | 2015-04-10 13:05:15.655000 | 192.168.1.200 | 0
Message received from /192.168.1.200 [Thread-7] | 2015-04-10 13:05:15.653000 | 192.168.1.202 | 23
Executing single-partition query on usertimespentpage [SharedPool-Worker-2] | 2015-04-10 13:05:15.653000 | 192.168.1.202 | 220
Acquiring sstable references [SharedPool-Worker-2] | 2015-04-10 13:05:15.653000 | 192.168.1.202 | 235
Merging memtable tombstones [SharedPool-Worker-2] | 2015-04-10 13:05:15.653000 | 192.168.1.202 | 259
Skipped 0/0 non-slice-intersecting sstables, included 0 due to tombstones [SharedPool-Worker-2] | 2015-04-10 13:05:15.654000 | 192.168.1.202 | 318
Merging data from memtables and 0 sstables [SharedPool-Worker-2] | 2015-04-10 13:05:15.654000 | 192.168.1.202 | 344
Read 1 live and 0 tombstoned cells [SharedPool-Worker-2] | 2015-04-10 13:05:15.654000 | 192.168.1.202 | 378
Enqueuing response to /192.168.1.200 [SharedPool-Worker-2] | 2015-04-10 13:05:15.654000 | 192.168.1.202 | 452
Sending message to /192.168.1.200 [WRITE-/192.168.1.200] | 2015-04-10 13:05:15.654000 | 192.168.1.202 | 575
Message received from /192.168.1.200 [Thread-7] | 2015-04-10 13:05:15.655000 | 192.168.1.201 | 11
Executing single-partition query on usertimespentpage [SharedPool-Worker-2] | 2015-04-10 13:05:15.655000 | 192.168.1.201 | 198
Parsing select * from userTimeSpentPage where cwc ='321KqwLrW2OY8IMT9aHJD3Bj27'; [SharedPool-Worker-1] | 2015-04-10 13:05:15.655000 | 192.168.1.200 | 45
Acquiring sstable references [SharedPool-Worker-2] | 2015-04-10 13:05:15.655000 | 192.168.1.201 | 207
Preparing statement [SharedPool-Worker-1] | 2015-04-10 13:05:15.655000 | 192.168.1.200 | 147
Merging memtable tombstones [SharedPool-Worker-2] | 2015-04-10 13:05:15.655000 | 192.168.1.201 | 227
Sending message to /192.168.1.201 [WRITE-/192.168.1.201] | 2015-04-10 13:05:15.655000 | 192.168.1.200 | 455
Skipped 0/0 non-slice-intersecting sstables, included 0 due to tombstones [SharedPool-Worker-2] | 2015-04-10 13:05:15.655000 | 192.168.1.201 | 280
Merging data from memtables and 0 sstables [SharedPool-Worker-2] | 2015-04-10 13:05:15.655000 | 192.168.1.201 | 285
Read 1 live and 0 tombstoned cells [SharedPool-Worker-2] | 2015-04-10 13:05:15.655001 | 192.168.1.201 | 322
Enqueuing response to /192.168.1.200 [SharedPool-Worker-2] | 2015-04-10 13:05:15.655001 | 192.168.1.201 | 423
Sending message to /192.168.1.200 [WRITE-/192.168.1.200] | 2015-04-10 13:05:15.655001 | 192.168.1.201 | 527
Sending message to /192.168.1.202 [WRITE-/192.168.1.202] | 2015-04-10 13:05:15.656000 | 192.168.1.200 | 1221
Message received from /192.168.1.201 [Thread-4] | 2015-04-10 13:05:15.657000 | 192.168.1.200 | 2094
Processing response from /192.168.1.201 [SharedPool-Worker-2] | 2015-04-10 13:05:15.657000 | 192.168.1.200 | 2134
Message received from /192.168.1.202 [Thread-5] | 2015-04-10 13:05:15.657000 | 192.168.1.200 | --
Processing response from /192.168.1.202 [SharedPool-Worker-1] | 2015-04-10 13:05:15.657000 | 192.168.1.200 | --
Request complete | 2015-04-10 13:05:15.657232 | 192.168.1.200 | 2232
【问题讨论】:
标签: caching cassandra cassandra-2.0 cassandra-cli