2012-01-04 137 views
1

我正在单个节点Cassandra设置上工作。我正在使用的系统具有8GB RAM的4核CPU。 这我使用的柱族的特性是:我该如何提高Cassandra的读/写性能?

Keyspace: keyspace1: 
    Replication Strategy: org.apache.cassandra.locator.NetworkTopologyStrategy 
    Durable Writes: true 
    Options: [datacenter1:1] 
    Column Families: 
    ColumnFamily: colfamily (Super) 
     Key Validation Class: org.apache.cassandra.db.marshal.UTF8Type 
     Default column value validator: org.apache.cassandra.db.marshal.UTF8Type 
     Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type/org.apache.cassandra.db.marshal.BytesType 
     Row cache size/save period in seconds/keys to save : 100000.0/0/all 
     Row Cache Provider: org.apache.cassandra.cache.ConcurrentLinkedHashCacheProvider 
     Key cache size/save period in seconds: 200000.0/14400 
     GC grace seconds: 864000 
     Compaction min/max thresholds: 4/32 
     Read repair chance: 1.0 
     Replicate on write: true 
     Built indexes: [] 
     Compaction Strategy: org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy 

我试图插入100万行一列族。写入吞吐量约为每秒2500,读取速度约为每秒380。

如何提高读写吞吐量?

+0

您使用多少个线程来运行您的示例? – zznate 2012-01-05 09:09:04

+0

@zznate:这个例子只有一个线程正在运行.. – 2012-01-05 10:47:43

+1

那么这对于一个线程是正确的。您可以使用apache源代码分发中的压力工具进行一些简单的性能验证:https://github.com/apache/cassandra/tree/trunk/tools/stress – zznate 2012-01-05 19:03:54

回答

1

每秒380意味着您正在从低速缓存命中率或OS正在交换的硬盘中读取数据。检查卡桑德拉统计数据以找出缓存使用情况:

./nodetool -host <IP> cfstats 

您已启用行和键缓存。行缓存将整行读入RAM - 意味着由行键给出的所有列。在这种情况下,您可以禁用密钥缓存。但请确保您有足够的可用RAM来处理行缓存。

如果您的Cassandra具有off-heap-cache(默认值为1.x),则行缓存可能非常大并且OS开始交换 - 检查交换大小 - 这可能会降低性能。

+0

谢谢您的回答。列族中的行只有一列,大小为4KB。这会影响吞吐量吗? – 2012-01-05 10:58:44

+0

否 - 在这种情况下使用行缓存并禁用密钥缓存 – 2012-01-10 14:30:43