How to determine logical/physical reads and writes in cassandra?

447 Views Asked by At

I'am currently investigating read and writes operations on cassandra. I would like to know about the read and writes that cassandra performs on the memtable and sstable. What is the closest value of the cassandra metrics? All I found are latency metrics, but this isn't what I'm searching for.

I would rather like to know how many real reads and writes occurs to build an abstract cost model for some specific operations.

Thank you!

Edit:

So it looks like ReadLatency and WriteLatency (Table Metrics) are what I've been searching for. However, if I want to read the metrics the Read Count is always 0.

My setup:

  • PopOS! 20.04 / Lenovo P1 G2 (512GB nvme SSD, 16GB Ram)
  • Cassandra 3.11.7 (Docker Container)
  • Datastax 4.5.1 Java Driver
  • Gathering metrics through Nodetools (been using the executable inside of the docker container) or with Telegraf 1.15.2 + Jolokina 1.6.2

My Telegraf config:

  [[inputs.jolokia2_agent.metric]]
    name  = "TableRead"
    mbean = "org.apache.cassandra.metrics:keyspace=*,name=ReadLatency,scope=*,type=Table"
    tag_keys = ["keyspace", "name", "scope"]
    field_prefix = "$2_"

  [[inputs.jolokia2_agent.metric]]
    name  = "TableWrite"
    mbean = "org.apache.cassandra.metrics:keyspace=*,name=WriteLatency,scope=*,type=Table"
    tag_keys = ["keyspace", "name", "scope"]
    field_prefix = "$2_"

Both are showing the Read Count as Zero on my Table (Write Counter is incrementing as expected) when running a query through my Java Application like this:

ResultSet rs = cqlSession.execute("SELECT * from myTable");
for(Row r : rs) {
    int id = rs.getObject("someColumn");
}

Why is the Read counter not incrementing?

1

There are 1 best solutions below

7
Alex Ott On

There are at least 2 types of the read/write metrics in the Cassandra:

  • local read/writes - the corresponding operations executed by replicas
  • client level read/writes - how this happens on the coordinator level. One read/write at coordinator level is converted into N local read/writes determined by consistency level and replication factor

Cassandra's Metrics page provides a list of available metrics, and you can get metrics specific for a table, or aggregated for a coordinator - you need to look to Latency metrics, like, ReadLatency for table, or ClientRequests.Read for coordinator.

For reads there are also other important metrics, like, number of SSTables hit during the read of specific table (the more you hit, worse is the latency), number of tombstones, etc. On the host level - things like, key cache hit rate is also very important. DataStax has a separate page about "important metrics" as part of their best practices docs.