You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by raja k <ra...@gmail.com> on 2019/06/27 19:51:13 UTC

Write count vs Local Write Count

Hello,

Can any one tell me the difference b/w Write Count vs Local write count from node tool tablestats output ?

Below is what I see for one of my table

 Write Count: 248214002
 Write Latency: 0.07470789510093795 ms.
  Local write count: 1183420
  Local write latency: NaN ms

Thanks,


Re: Write count vs Local Write Count

Posted by Alain RODRIGUEZ <ar...@gmail.com>.
Hello,

I tried to get the exact understanding of it. Rather than checking the code
(which I invite you to do alternatively), I played around with CCM:

$ tail -n 100 *

==> schema_collection.cql <==

DROP KEYSPACE IF EXISTS tlp_labs;


CREATE KEYSPACE tlp_labs

  WITH REPLICATION = {

   'class' : 'SimpleStrategy',

   'replication_factor' : 2

  };



CREATE TYPE tlp_labs.item (

  csn bigint,

  name text

);



CREATE TABLE tlp_labs.products (

  product_id bigint PRIMARY KEY,

  items map<bigint, frozen<item>>

);


CREATE TABLE tlp_labs.services (

  service_id bigint PRIMARY KEY,

  items map<bigint, frozen<item>>

);


==> update_collections.cql <==

UPDATE tlp_labs.products USING TTL 1000 SET items = items + {10: {csn: 100,
name: 'item100'}} WHERE product_id = 1;

UPDATE tlp_labs.products USING TTL 2000 SET items = items + {20: {csn: 200,
name: 'item200'}} WHERE product_id = 1;

UPDATE tlp_labs.products USING TTL 3000 SET items = items + {30: {csn: 300,
name: 'item300'}} WHERE product_id = 2;

UPDATE tlp_labs.services USING TTL 4000 SET items = items + {40: {csn: 400,
name: 'item400'}} WHERE service_id = 4;

UPDATE tlp_labs.services USING TTL 4000 SET items = items + {40: {csn: 400,
name: 'item400'}} WHERE service_id = 3;

UPDATE tlp_labs.services USING TTL 4000 SET items = items + {40: {csn: 400,
name: 'item400'}} WHERE service_id = 5;

The tool presents values like this (on 3 distinct nodes):


$ for i in $(seq 1 3); do echo "Node $i"; ccm node$i nodetool tablestats
tlp_labs | grep -i -e Table: -e Keyspace  -e 'write count'; done

Node 1

Keyspace : tlp_labs

Write Count: 4

Table: products

Local write count: 2

Table: services

Local write count: 2

Node 2

Keyspace : tlp_labs

Write Count: 5

Table: products

Local write count: 3

Table: services

Local write count: 2

Node 3

Keyspace : tlp_labs

Write Count: 3

Table: products

Local write count: 1

Table: services

Local write count: 2




The local write count is at the table level and shows reads that really hit
that node. If at the client/coordinator level there are 6 queries and the
RF is 2 like here, you can expect a total 'Write Count' at the keyspace
level of 12.


Can any one tell me the difference b/w Write Count vs Local write count
> from node tool tablestats output ?


To answer your question It seems that the 'Write Count' is a sum of the
'Local write count' of all the tables.
Which (this Write Count sum from all nodes) should be <RF> times bigger
than the queries sent. Does it make sense with what you're seeing?

It was a bit confusing for me at start as I was somewhat expecting this to
be the coordinator/client request counts, mostly because in Metrics the
'Local' prefix is always used in the name of 'local' counts, and the
coordinator metrics are called 'Write Count' without the local prefix :).
But it's not the case here. 'nodetool tablestats' **only** shows **local**
writes, and 'Write Count' at the keyspace level is just a sum of all the
table metrics as detailed per table below 'local write count'.

This makes more sense to me now, because we are unable to get metrics at
the coordinator level per table or keyspace. It's always per host for
client request counts metrics.

I hope I did not make it more confusing, let me know if I'm unclear or if
it doesn't suit your own observations. Thanks for the questions, I could
also rework my understanding here :).

C*heers,
-----------------------
Alain Rodriguez - alain@thelastpickle.com
France / Spain

The Last Pickle - Apache Cassandra Consulting
http://www.thelastpickle.com

Le jeu. 27 juin 2019 à 21:51, raja k <ra...@gmail.com> a écrit :

> Hello,
>
> Can any one tell me the difference b/w Write Count vs Local write count
> from node tool tablestats output ?
>
> Below is what I see for one of my table
>
>  Write Count: 248214002
>  Write Latency: 0.07470789510093795 ms.
>   Local write count: 1183420
>   Local write latency: NaN ms
>
> Thanks,
>
>