首页 > 解决方案 > 检查每张桌子上的 cassandra 负载

问题描述

有没有办法弄清楚每张桌子上有多少请求(读/写)?

我想弄清楚我们在哪里有很大的负担。

已经尝试使用:

nodetool tablestats

这不好,因为我看不到请求的数量。

谢谢

标签: cassandranosqldatastax-enterprisedatastax-startupdatastax-php-driver

解决方案


tablestats将为您提供可能足够的请求总数。还可以查看异常值的平均本地读/写延迟。费率在 JMX 中公开,您可以从表指标中获取: http: //cassandra.apache.org/doc/latest/operating/metrics.html#table-metrics

org.apache.cassandra.metrics:type=Table keyspace=<Keyspace> scope=<Table> name=<MetricName>

Metric Name             Tye      Description
--------------------------------------------------------------------------
ReadLatency             Latency  Local read latency for this table.
RangeLatency            Latency  Local range scan latency for this table.
WriteLatency            Latency  Local write latency for this table.
CoordinatorReadLatency  Timer    Coordinator read latency for this table.
CoordinatorWriteLatency Timer    Coordinator write latency for this table.
CoordinatorScanLatency  Timer    Coordinator range scan latency for this table.

每个都有 1、5 和 15 分钟的速率属性。

即用瑞士爪哇刀

java -jar sjk.jar mx -p {PID} -b org.apache.cassandra.metrics:type=ColumnFamily,keyspace=<Keyspace>,scope=<Table>,name=CoordinatorReadLatency --attribute FiveMinuteRate --get 

(注意:以与您的 cassandra 实例运行时相同的用户身份运行它,sudo -u或者它可能没有附加到 jvm 的权限)

如果当前运行的负载很高,您可以使用toppartitionsprofileload。在某些版本中,toppartitions 需要你给它表格。

#> nodetool profileload

Frequency of reads by partition:
   Table        Partition Count +/-
   basic.wide   row1      75424 0 
   basic.cas    p1        656   0
   system.paxos 7031      550   0 
   system.local local     2     0 

Frequency of writes by partition:
   Table        Partition Count +/-
   system.paxos 7031      585   0 
   basic.cas    p1        112   0 
   basic.wide   row4864   20    19
   basic.wide   row4870   20    19
   basic.wide   row4868   20    19
   basic.wide   row4871   20    19

Frequency of cas contentions by partition:
   Table     Partition Count +/-
   basic.cas p1        76    0 

Max mutation size by partition:
   Table      Partition Bytes
   basic.wide row0      1056
   basic.wide row7      1056
   basic.wide row11     1056
   basic.wide row59     1056
   basic.wide row255    1056

Longest read query times:
   Query                                                Microseconds
   SELECT * FROM basic.wide WHERE key = row1 LIMIT 5000 25681       
   SELECT * FROM basic.wide WHERE key = row1 LIMIT 5000 16131       
   SELECT * FROM basic.wide WHERE key = row1 LIMIT 5000 14715        
   SELECT * FROM system_schema.columns                  2784        
   SELECT * FROM system_schema.columns                  2285        
   SELECT * FROM system_schema.tables                   1553        
   SELECT * FROM system_schema.tables                   1275  

推荐阅读