function table_latency {
(echo 'Table ReadCount WriteCount ReadLatency(ms) WriteLatency(ms) TotalRead(sec) TotalWrite(sec)' && \
nodetool cfstats $1 | grep 'Table:\|Local' | \
awk -F" " '{
if (index($1,"Table:") != 0) {
t = $2; getline
rc = $4; getline
rl = $4; getline
wc = $4; getline
wl = $4
printf "%s %s %s %s %s %.2f %.2f \n", t, rc, wc, rl, wl, rc*rl/1000, wc*wl/1000
}
}' \
| sort -nk4) | column -t
}
function index_latency {
(echo 'Table ReadCount WriteCount ReadLatency(ms) WriteLatency(ms) TotalRead(sec) TotalWrite(sec)' && \
nodetool cfstats $1 | grep 'Local\|Table (' | sed -e "s/ (index)//" | \
awk -F" " '{
if (index($1,"Table") != 0) {
t = $2; getline
rc = $4; getline
rl = $4; getline
wc = $4; getline
wl = $4
printf "%s %s %s %s %s %.2f %.2f \n", t, rc, wc, rl, wl, rc*rl/1000, wc*wl/1000
}
}' \
| sort -nk4) | column -t
}
function tombstones {
(echo 'Table LiveAverage LiveMax TombsoneAverage TombsoneMax' && \
nodetool cfstats $1 | grep 'live cells\|tombstone\|Table (\|Table:' | sed -e "s/ (index)//" | \
awk -F" " '{
if (index($1,"Table") != 0) {
t = $2; getline
avglive = $9; getline
maxlive = $9; getline
avgtomb = $8; getline
maxtomb = $8;
printf "%s %.2f %.2f %.2f %.2f \n", t, avglive, maxlive, avgtomb, maxtomb
}
}' \
| sort -nk4) | column -t
}