如何提高Cassandra的读/写性能?

时间:2012-01-04 11:33:44

标签: performance cassandra

我正在开发一个单节点Cassandra设置。我使用的系统有4核CPU,8GB RAM。 我正在使用的列族的属性是:

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次。

如何提高读写吞吐量?

1 个答案:

答案 0 :(得分:1)

每秒380意味着您正在从低速缓存命中率或操作系统交换的硬盘驱动器中读取数据。检查Cassandra统计信息以查找缓存使用情况:

./nodetool -host <IP> cfstats

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

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

相关问题