SlideShare a Scribd company logo
1 of 83
Chris Lohfink
Cassandra Metrics
About me
• Software developer at DataStax
• OpsCenter, Metrics & Cassandra interactions
© DataStax, All Rights Reserved. 2
What this talk is
• What does the thing the metrics report mean (da dum tis)
• How metrics evolved in C*
© DataStax, All Rights Reserved. 3
Collecting
Not how, but what and why
Cassandra Metrics
• For the most part metrics do not break backwards compatibility
• Until they do (from deprecation or bugs)
• Deprecated metrics are hard to identify without looking at source
code, so their disappearance may have surprising impacts even if
deprecated for years.
• i.e. Cassandra 2.2 removal of “Recent Latency” metrics
© DataStax, All Rights Reserved. 5
C* Metrics Pre-1.1
© DataStax, All Rights Reserved. 6
• Classes implemented MBeans and metrics were added in place
• ColumnFamilyStore -> ColumnFamilyStoreMBean
• Semi-adhoc, tightly coupled to code but had a “theme” or common
abstractions
Latency Tracker
• LatencyTracker stores:
• recent histogram
• total histogram
• number of ops
• total latency
• Use latency/#ops since last time called to compute “recent” average
latency
• Every time queried it will reset the latency and histogram.
© DataStax, All Rights Reserved. 7
Describing Latencies
© DataStax, All Rights Reserved. 8
0 100 200 300 400 500 600 700 800 900 1000
• Listing the raw the values:
13ms, 14ms, 2ms, 13ms, 90ms, 734ms, 8ms, 23ms, 30ms
• Doesn’t scale well
• Not easy to parse, with larger amounts can be difficult to find high values
Describing Latencies
© DataStax, All Rights Reserved. 9
0 100 200 300 400 500 600 700 800 900 1000
• Average:
• 103ms
Describing Latencies
© DataStax, All Rights Reserved. 10
0 100 200 300 400 500 600 700 800 900 1000
• Average:
• 103ms
Describing Latencies
© DataStax, All Rights Reserved. 11
0 100 200 300 400 500 600 700 800 900 1000
• Average:
• 103ms
• Missing outliers
Describing Latencies
© DataStax, All Rights Reserved. 12
0 100 200 300 400 500 600 700 800 900 1000
• Average:
• 103ms
• Missing outliers
• Max: 734ms
• Min: 2ms
Describing Latencies
© DataStax, All Rights Reserved. 13
0 100 200 300 400 500 600 700 800 900 1000
• Average:
• 103ms
• Missing outliers
• Max: 734ms
• Min: 2ms
Latency Tracker
• LatencyTracker stores:
• recent histogram
• total histogram
• number of ops
• total latency
• Use latency/#ops since last time called to compute “recent”
average latency
• Every time queried it will reset the latency and histogram.
© DataStax, All Rights Reserved. 14
Recent Average Latencies
© DataStax, All Rights Reserved. 15
0 100 200 300 400 500 600 700 800 900 1000
• Reported latency from
• Sum of latencies since last called
• Number of requests since last called
• Average:
• 103ms
• Outliers lost
Histograms
• Describes frequency of data
© DataStax, All Rights Reserved. 16
1, 2, 1, 1, 3, 4, 3, 1
Histograms
• Describes frequency of data
1
© DataStax, All Rights Reserved. 17
1, 2, 1, 1, 3, 4, 3, 1
Histograms
• Describes frequency of data
1
2
© DataStax, All Rights Reserved. 18
1, 2, 1, 1, 3, 4, 3, 1
Histograms
• Describes frequency of data
11
2
© DataStax, All Rights Reserved. 19
1, 2, 1, 1, 3, 4, 3, 1
Histograms
• Describes frequency of data
111
2
© DataStax, All Rights Reserved. 20
1, 2, 1, 1, 3, 4, 3, 1
Histograms
• Describes frequency of data
111
2
3
© DataStax, All Rights Reserved. 21
1, 2, 1, 1, 3, 4, 3, 1
Histograms
• Describes frequency of data
111
2
3
4
© DataStax, All Rights Reserved. 22
1, 2, 1, 1, 3, 4, 3, 1
Histograms
• Describes frequency of data
111
2
33
4
© DataStax, All Rights Reserved. 23
1, 2, 1, 1, 3, 4, 3, 1
Histograms
• Describes frequency of data
1111
2
33
4
© DataStax, All Rights Reserved. 24
1, 2, 1, 1, 3, 4, 3, 1
Histograms
• Describes frequency of data
1111
2
33
4
© DataStax, All Rights Reserved. 25
1, 2, 1, 1, 3, 4, 3, 1
0 1 2 3 4
4
3
2
1
Count
Histograms
• "bin" the range of values
• divide the entire range of values into a series of intervals
• Count how many values fall into each interval
© DataStax, All Rights Reserved. 26
Histograms
• "bin" the range of values—that is, divide the entire range of values
into a series of intervals—and then count how many values fall into
each interval
© DataStax, All Rights Reserved. 27
0 100 200 300 400 500 600 700 800 900 1000
13, 14, 2, 20, 13, 90, 734, 8, 53, 23, 30
Histograms
• "bin" the range of values—that is, divide the entire range of values
into a series of intervals—and then count how many values fall into
each interval
© DataStax, All Rights Reserved. 28
13, 14, 2, 20, 13, 90, 734, 8, 53, 23, 30
Histograms
• "bin" the range of values—that is, divide the entire range of values
into a series of intervals—and then count how many values fall into
each interval
© DataStax, All Rights Reserved. 29
2, 8, 13, 13, 14, 20, 23, 30, 53, 90, 734
Histograms
• "bin" the range of values—that is, divide the entire range of values
into a series of intervals—and then count how many values fall into
each interval
© DataStax, All Rights Reserved. 30
2, 8, 13, 13, 14, 20, 23, 30, 53, 90, 734
1-10 11-100 101-1000
2 8 1
Histograms
Approximations
Max: 1000 (actual 734)
© DataStax, All Rights Reserved. 31
1-10 11-100 101-1000
2 8 1
Histograms
Approximations
Max: 1000 (actual 734)
Min: 10 (actual 2)
© DataStax, All Rights Reserved. 32
1-10 11-100 101-1000
2 8 1
Histograms
Approximations
Max: 1000 (actual 734)
Min: 10 (actual 2)
Average: sum / count, (10*2 + 100*8 + 1000*1) / (2+8+1) = 165 (actual 103)
© DataStax, All Rights Reserved. 33
1-10 11-100 101-1000
2 8 1
Histograms
Approximations
Max: 1000 (actual 734)
Min: 10 (actual 2)
Average: sum / count, (10*2 + 100*8 + 1000*1) / (2+8+1) = 165 (actual 103)
Percentiles: 11 requests, so we know 90 percent of the latencies occurred in the 11-100 bucket or
lower.
90th Percentile: 100
© DataStax, All Rights Reserved. 34
1-10 11-100 101-1000
2 8 1
Histograms
Approximations
Max: 1000 (actual 734)
Min: 10 (actual 2)
Average: sum / count, (10*2 + 100*8 + 1000) / (2+8+1) = 165 (actual 103)
Percentiles: 11 requests, so we know 90 percent of the latencies occurred in the 11-100 bucket or
lower.
90th Percentile: 100
© DataStax, All Rights Reserved. 35
1-10 11-100 101-1000
2 8 1
EstimatedHistogram
The series starts at 1 and grows by 1.2 each time
1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 17, 20, 24, 29,
…
12108970, 14530764, 17436917, 20924300, 25109160
© DataStax, All Rights Reserved. 36
LatencyTracker
Has two histograms
• Recent
• Count of times a latency occurred since last time read for each bin
• Total
• Count of times a latency occurred since Cassandra started for each bin
© DataStax, All Rights Reserved. 37
Total Histogram Deltas
If you keep track of histogram last time you read it can find delta to determine
how many occurred in that interval
Last
Now
© DataStax, All Rights Reserved. 38
1-10 11-100 101-1000
2 8 1
1-10 11-100 101-1000
4 8 2
Total Histogram Deltas
If you keep track of histogram last time you read it can find delta to determine
how many occurred in that interval
Last
Now
Delta
© DataStax, All Rights Reserved.
1-10 11-100 101-1000
2 8 1
1-10 11-100 101-1000
4 8 2
1-10 11-100 101-1000
2 0 1
Cassandra 1.1
• Yammer/Codahale/Dropwizard Metrics introduced
• Awesome!
• Not so awesome…
© DataStax, All Rights Reserved. 40
Reservoirs
• Maintain a sample of the data that is representative of the entire set.
• Can perform operations on the limited, fixed memory set as if on entire dataset
• Vitters Algorithm R
• Offers a 99.9% confidence level & 5% margin of error
• Simple
• Randomly include value in reservoir, less and less likely as more
values seen
© DataStax, All Rights Reserved. 41
Reservoirs
• Maintain a sample of the data that is representative of the entire set.
• Can perform operations on the limited, fixed memory set as if on entire dataset
• Vitters Algorithm R
• Offers a 99.9% confidence level & 5% margin of error
* When the stream has a normal distribution
© DataStax, All Rights Reserved. 42
Metrics Reservoirs
• Random sampling, what can it miss?
– Min
– Max
– Everything in 99th percentile?
– The more rare, the less likely to be included
43
Metrics Reservoirs
• “Good enough” for basic adhoc viewing but too non-deterministic for many
• Commonly resolved using replacement reservoirs (i.e. HdrHistogram)
44
Metrics Reservoirs
• “Good enough” for basic adhoc viewing but too non-deterministic for many
• Commonly resolved using replacement reservoirs (i.e. HdrHistogram)
– org.apache.cassandra.metrics.EstimatedHistogramReservoir
45
Cassandra 2.2
• CASSANDRA-5657 – upgrade metrics library (and extend it)
– Replaced reservoir with EH
• Also exposed raw bin counts in values operation
– Deleted deprecated metrics
• Non EH latencies from LatencyTracker
46
Cassandra 2.2
• No recency in histograms
• Requires delta’ing on the total bin counts currently which is beyond
some simple tooling
• CASSANDRA-11752 (fixed 2.2.8, 3.0.9, 3.8)
47
Storage
Storing the data
• We have data, now to store it. Approaches tend to follow:
– Store all data points
• Provide aggregations either pre-computed as entered, MR, or on query
– Round Robin Database
• Only store pre-computed aggregations
• Choice depends heavily on requirements
49
Round Robin Database
• Store state required to generate the aggregations, and only store the
aggregations
– Sum & Count for Average
– Current min, max
– “One pass” or “online” algorithms
• Constant footprint
50
Round Robin Database
• Store state required to generate the aggregations, and only store the aggregations
– Sum & Count for Average
– Current min, max
– “One pass” or “online” algorithms
• Constant footprint
51
60 300 3600
Sum 0 0 0
Count 0 0 0
Min 0 0 0
Max 0 0 0
Round Robin Database
> 10ms @ 00:00
52
60 300 3600
Sum 10 10 10
Count 1 1 1
Min 10 10 10
Max 10 10 10
Round Robin Database
> 10ms @ 00:00
> 12ms @ 00:30
53
60 300 3600
Sum 22 22 22
Count 2 2 2
Min 10 10 10
Max 12 12 12
Round Robin Database
> 10ms @ 00:00
> 12ms @ 00:30
> 14ms @ 00:59
54
60 300 3600
Sum 36 36 36
Count 3 3 3
Min 10 10 10
Max 14 14 14
Round Robin Database
> 10ms @ 00:00
> 12ms @ 00:30
> 14ms @ 00:59
> 13ms @ 01:10
55
60 300 3600
Sum 36 36 36
Count 3 3 3
Min 10 10 10
Max 14 14 14
Round Robin Database
> 10ms @ 00:00
> 12ms @ 00:30
> 14ms @ 00:59
> 13ms @ 01:10
56
60 300 3600
Sum 36 36 36
Count 3 3 3
Min 10 10 10
Max 14 14 14
Average 12
Min 10
Max 14
Round Robin Database
> 10ms @ 00:00
> 12ms @ 00:30
> 14ms @ 00:59
> 13ms @ 01:10
57
60 300 3600
Sum 0 36 36
Count 0 3 3
Min 0 10 10
Max 0 14 14
Round Robin Database
> 10ms @ 00:00
> 12ms @ 00:30
> 14ms @ 00:59
> 13ms @ 01:10
58
60 300 3600
Sum 13 49 49
Count 1 4 4
Min 13 10 10
Max 13 14 14
Max is a lie
• The issue with the deprecated LatencyTracker metrics is that the 1 minute interval
does not have a min/max. So we cannot compute true min/max
the rollups min/max will be the minimum and maximum average
59
Histograms to the rescue (again)
• The histograms of the data does not have this issue. But storage is
more complex. Some options include:
– Store each bin of the histogram as a metric
– Store the percentiles/min/max each as own metric
– Store raw long[90] (possibly compressed)
60
Histogram Storage Size
• Some things to note:
– “Normal” clusters have over 100 tables.
– Each table has at least two histograms we want to record
• Read latency
• Write latency
• Tombstones scanned
• Cells scanned
• Partition cell size
• Partition cell count
61
Histogram Storage
Because we store the extra histograms we have a 600 (minimum) with upper
bounds seen to be over 24,000 histograms per minute.
• Storing 1 per bin means [54000] metrics (expensive to store, expensive to
read)
• Storing raw histograms is [600] metrics
• Storing min, max, 50th, 90th, 99th is [3000] metrics
– Additional problems with this
• Cant compute 10th, 95th, 99.99th etc
• Aggregations
62
Aggregating Histograms
Averaging the percentiles
[ INSERT DISAPOINTED GIL TENE PHOTO ]
© DataStax, All Rights Reserved. 63
Aggregating Histograms
• Consider averaging the maximum
If there is a node with a 10 second GC, but the maximum latency on your other 9 nodes
is 60ms. If you report a “Max 1 second” latency, it would be misleading.
• Poor at representing hotspots affects on your application
One node in 10 node raspberry pi cluster gets 1000 write reqs/sec while others get 10
reqs/sec. The 1 node being under heavy stress has a 90th percentile of 10 second. The
other nodes are basically sub ms and writes are taking 1ms on 90th percentile. Would
report a 1 second 90th percentile, even though 10% of our applications writes are taking
>10 seconds
© DataStax, All Rights Reserved. 64
Aggregating Histograms
Merging histograms from different nodes more accurately can be straight forward:
Node1
Node2
Cluster
© DataStax, All Rights Reserved. 65
1-10 11-100 101-1000
2 8 1
1-10 11-100 101-1000
2 1 5
1-10 11-100 101-1000
4 9 6
Histogram Storage
Because we store the extra histograms we have a 600 (minimum) with upper
bounds seen to be over 24,000 histograms per minute.
• Storing 1 per bin means [54000] metrics (expensive to store, expensive to
read)
• Storing raw histograms is [600] metrics
• Storing min, max, 50th, 90th, 99th is [3000] metrics
– Additional problems with this
• Cant compute 10th, 95th, 99.99th etc
• Aggregations
66
Raw Histogram storage
• Storing raw histograms 160 (default) longs is a minimum of 1.2kb
bytes per rollup and hard sell
– 760kb per minute (600 tables)
– 7.7gb for the 7 day TTL we want to keep our 1 min rollups at
– ~77gb with 10 nodes
– ~2.3 Tb on 10 node clusters with 3k tables
– Expired data isn’t immediately purged so disk space can be much worse
67
Raw Histogram storage
• Goal: We wanted this to be comparable to other min/max/avg metric
storage (12 bytes each)
– 700mb on expected 10 node cluster
– 2gb on extreme 10 node cluster
• Enter compression
68
Compressing Histograms
• Overhead of typical compression makes it a non-starter.
– headers (ie 10 bytes for gzip) alone nearly exceeds the length used by
existing rollup storage (~12 bytes per metric)
• Instead we opt to leverage known context to reduce the size of the
data along with some universal encoding.
69
Compressing Histograms
• Instead of storing every bin, only store the value of each bin with a value > 0
since most bin will have no data (ie, very unlikely for a read histogram to be
between 1-10 microseconds which is first 10 bins)
• Write the count of offset/count pairs
• Use varint for the bin count
– To reduce the value of the varint as much as possible we sort the offset/count
pairs by the count and represent it as a delta sequence
70
Compressing Histograms
0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
71
1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte
1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte
1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte
Compressing Histograms
0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
72
7
Compressing Histograms
0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
{4:1, 8:100, 11:9999999, 14:1, 15:127, 16:128 17:129}
73
7
Compressing Histograms
0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
{4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999}
74
7
Compressing Histograms
0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
{4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999}
75
7 4 1
Compressing Histograms
0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
{4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999}
76
7 4 1 14 0
Compressing Histograms
0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
{4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999}
77
7 4 1 14 0 8 99
Compressing Histograms
0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
{4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999}
78
7 4 1 14 0 8 99 15
27
Compressing Histograms
0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
{4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999}
79
7 4 1 14 0 8 99 15
27 16 1 17 1
Compressing Histograms
0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
{4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999}
80
7 4 1 14 0 8 99 15
27 16 1 17 1 11
9999870
Compressing Histograms
Real Life** results of compression:
81
Size in bytes
Median 1
75th 3
95th 15
99th 45
Max** 124
Note on HdrHistogram
• Comes up every couple months
• Very awesome histogram, popular replacement for Metrics reservoir.
– More powerful and general purpose than EH
– Only slightly slower for all it offers
A issue comes up a bit with storage:
• Logged HdrHistograms are ~31kb each (30,000x more than our average use)
• Compressed version: 1kb each
• Perfect for many many people when tracking 1 or two metrics. Gets painful when
tracking hundreds or thousands
82
Questions?

More Related Content

What's hot

What's hot (20)

Apache Arrow: In Theory, In Practice
Apache Arrow: In Theory, In PracticeApache Arrow: In Theory, In Practice
Apache Arrow: In Theory, In Practice
 
Galera Cluster Best Practices for DBA's and DevOps Part 1
Galera Cluster Best Practices for DBA's and DevOps Part 1Galera Cluster Best Practices for DBA's and DevOps Part 1
Galera Cluster Best Practices for DBA's and DevOps Part 1
 
Cassandra concepts, patterns and anti-patterns
Cassandra concepts, patterns and anti-patternsCassandra concepts, patterns and anti-patterns
Cassandra concepts, patterns and anti-patterns
 
Planning for Disaster Recovery (DR) with Galera Cluster
Planning for Disaster Recovery (DR) with Galera ClusterPlanning for Disaster Recovery (DR) with Galera Cluster
Planning for Disaster Recovery (DR) with Galera Cluster
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDB
 
PostgreSQL worst practices, version PGConf.US 2017 by Ilya Kosmodemiansky
PostgreSQL worst practices, version PGConf.US 2017 by Ilya KosmodemianskyPostgreSQL worst practices, version PGConf.US 2017 by Ilya Kosmodemiansky
PostgreSQL worst practices, version PGConf.US 2017 by Ilya Kosmodemiansky
 
Cassandra nice use cases and worst anti patterns
Cassandra nice use cases and worst anti patternsCassandra nice use cases and worst anti patterns
Cassandra nice use cases and worst anti patterns
 
How to size up an Apache Cassandra cluster (Training)
How to size up an Apache Cassandra cluster (Training)How to size up an Apache Cassandra cluster (Training)
How to size up an Apache Cassandra cluster (Training)
 
Jvm tuning for low latency application & Cassandra
Jvm tuning for low latency application & CassandraJvm tuning for low latency application & Cassandra
Jvm tuning for low latency application & Cassandra
 
Jvm & Garbage collection tuning for low latencies application
Jvm & Garbage collection tuning for low latencies applicationJvm & Garbage collection tuning for low latencies application
Jvm & Garbage collection tuning for low latencies application
 
BlueStore: a new, faster storage backend for Ceph
BlueStore: a new, faster storage backend for CephBlueStore: a new, faster storage backend for Ceph
BlueStore: a new, faster storage backend for Ceph
 
Real Time Test Data with Grafana
Real Time Test Data with GrafanaReal Time Test Data with Grafana
Real Time Test Data with Grafana
 
Impacts of Sharding, Partitioning, Encoding, and Sorting on Distributed Query...
Impacts of Sharding, Partitioning, Encoding, and Sorting on Distributed Query...Impacts of Sharding, Partitioning, Encoding, and Sorting on Distributed Query...
Impacts of Sharding, Partitioning, Encoding, and Sorting on Distributed Query...
 
Bucket your partitions wisely - Cassandra summit 2016
Bucket your partitions wisely - Cassandra summit 2016Bucket your partitions wisely - Cassandra summit 2016
Bucket your partitions wisely - Cassandra summit 2016
 
Spark Tips & Tricks
Spark Tips & TricksSpark Tips & Tricks
Spark Tips & Tricks
 
Using Time Window Compaction Strategy For Time Series Workloads
Using Time Window Compaction Strategy For Time Series WorkloadsUsing Time Window Compaction Strategy For Time Series Workloads
Using Time Window Compaction Strategy For Time Series Workloads
 
A Deep Dive into Apache Cassandra for .NET Developers
A Deep Dive into Apache Cassandra for .NET DevelopersA Deep Dive into Apache Cassandra for .NET Developers
A Deep Dive into Apache Cassandra for .NET Developers
 
Introduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard BrokerIntroduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard Broker
 
C* Summit 2013: The World's Next Top Data Model by Patrick McFadin
C* Summit 2013: The World's Next Top Data Model by Patrick McFadinC* Summit 2013: The World's Next Top Data Model by Patrick McFadin
C* Summit 2013: The World's Next Top Data Model by Patrick McFadin
 
Drilling into Data with Apache Drill
Drilling into Data with Apache DrillDrilling into Data with Apache Drill
Drilling into Data with Apache Drill
 

Similar to Storing Cassandra Metrics (Chris Lohfink, DataStax) | C* Summit 2016

Introduce Apache Cassandra - JavaTwo Taiwan, 2012
Introduce Apache Cassandra - JavaTwo Taiwan, 2012Introduce Apache Cassandra - JavaTwo Taiwan, 2012
Introduce Apache Cassandra - JavaTwo Taiwan, 2012
Boris Yen
 
Cassandra
CassandraCassandra
Cassandra
exsuns
 
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
DataStax
 

Similar to Storing Cassandra Metrics (Chris Lohfink, DataStax) | C* Summit 2016 (20)

"Einstürzenden Neudaten: Building an Analytics Engine from Scratch", Tobias J...
"Einstürzenden Neudaten: Building an Analytics Engine from Scratch", Tobias J..."Einstürzenden Neudaten: Building an Analytics Engine from Scratch", Tobias J...
"Einstürzenden Neudaten: Building an Analytics Engine from Scratch", Tobias J...
 
Drinking from the Firehose - Real-time Metrics
Drinking from the Firehose - Real-time MetricsDrinking from the Firehose - Real-time Metrics
Drinking from the Firehose - Real-time Metrics
 
Everyday I'm Scaling... Cassandra (Ben Bromhead, Instaclustr) | C* Summit 2016
Everyday I'm Scaling... Cassandra (Ben Bromhead, Instaclustr) | C* Summit 2016Everyday I'm Scaling... Cassandra (Ben Bromhead, Instaclustr) | C* Summit 2016
Everyday I'm Scaling... Cassandra (Ben Bromhead, Instaclustr) | C* Summit 2016
 
Everyday I’m scaling... Cassandra
Everyday I’m scaling... CassandraEveryday I’m scaling... Cassandra
Everyday I’m scaling... Cassandra
 
Apache con 2020 use cases and optimizations of iotdb
Apache con 2020 use cases and optimizations of iotdbApache con 2020 use cases and optimizations of iotdb
Apache con 2020 use cases and optimizations of iotdb
 
Cyclone DDS Unleashed: Scalability in DDS and Dealing with Large Systems
Cyclone DDS Unleashed: Scalability in DDS and Dealing with Large SystemsCyclone DDS Unleashed: Scalability in DDS and Dealing with Large Systems
Cyclone DDS Unleashed: Scalability in DDS and Dealing with Large Systems
 
Introduce Apache Cassandra - JavaTwo Taiwan, 2012
Introduce Apache Cassandra - JavaTwo Taiwan, 2012Introduce Apache Cassandra - JavaTwo Taiwan, 2012
Introduce Apache Cassandra - JavaTwo Taiwan, 2012
 
Chronix Poster for the Poster Session FAST 2017
Chronix Poster for the Poster Session FAST 2017Chronix Poster for the Poster Session FAST 2017
Chronix Poster for the Poster Session FAST 2017
 
The Case for a Signal Oriented Data Stream Management System
The Case for a Signal Oriented Data Stream Management SystemThe Case for a Signal Oriented Data Stream Management System
The Case for a Signal Oriented Data Stream Management System
 
What you need to know about GC
What you need to know about GCWhat you need to know about GC
What you need to know about GC
 
Cassandra
CassandraCassandra
Cassandra
 
Aerospike Go Language Client
Aerospike Go Language ClientAerospike Go Language Client
Aerospike Go Language Client
 
JVM Garbage Collection Tuning
JVM Garbage Collection TuningJVM Garbage Collection Tuning
JVM Garbage Collection Tuning
 
DataStax TechDay - Munich 2014
DataStax TechDay - Munich 2014DataStax TechDay - Munich 2014
DataStax TechDay - Munich 2014
 
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
What We Learned About Cassandra While Building go90 (Christopher Webster & Th...
 
Time Series Analysis
Time Series AnalysisTime Series Analysis
Time Series Analysis
 
Time Series Processing with Solr and Spark
Time Series Processing with Solr and SparkTime Series Processing with Solr and Spark
Time Series Processing with Solr and Spark
 
Time Series Processing with Solr and Spark: Presented by Josef Adersberger, Q...
Time Series Processing with Solr and Spark: Presented by Josef Adersberger, Q...Time Series Processing with Solr and Spark: Presented by Josef Adersberger, Q...
Time Series Processing with Solr and Spark: Presented by Josef Adersberger, Q...
 
InfluxEnterprise Architecture Patterns by Tim Hall & Sam Dillard
InfluxEnterprise Architecture Patterns by Tim Hall & Sam DillardInfluxEnterprise Architecture Patterns by Tim Hall & Sam Dillard
InfluxEnterprise Architecture Patterns by Tim Hall & Sam Dillard
 
«Scrapy internals» Александр Сибиряков, Scrapinghub
«Scrapy internals» Александр Сибиряков, Scrapinghub«Scrapy internals» Александр Сибиряков, Scrapinghub
«Scrapy internals» Александр Сибиряков, Scrapinghub
 

More from DataStax

More from DataStax (20)

Is Your Enterprise Ready to Shine This Holiday Season?
Is Your Enterprise Ready to Shine This Holiday Season?Is Your Enterprise Ready to Shine This Holiday Season?
Is Your Enterprise Ready to Shine This Holiday Season?
 
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
Designing Fault-Tolerant Applications with DataStax Enterprise and Apache Cas...
 
Running DataStax Enterprise in VMware Cloud and Hybrid Environments
Running DataStax Enterprise in VMware Cloud and Hybrid EnvironmentsRunning DataStax Enterprise in VMware Cloud and Hybrid Environments
Running DataStax Enterprise in VMware Cloud and Hybrid Environments
 
Best Practices for Getting to Production with DataStax Enterprise Graph
Best Practices for Getting to Production with DataStax Enterprise GraphBest Practices for Getting to Production with DataStax Enterprise Graph
Best Practices for Getting to Production with DataStax Enterprise Graph
 
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step JourneyWebinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
Webinar | Data Management for Hybrid and Multi-Cloud: A Four-Step Journey
 
Webinar | How to Understand Apache Cassandra™ Performance Through Read/Writ...
Webinar  |  How to Understand Apache Cassandra™ Performance Through Read/Writ...Webinar  |  How to Understand Apache Cassandra™ Performance Through Read/Writ...
Webinar | How to Understand Apache Cassandra™ Performance Through Read/Writ...
 
Webinar | Better Together: Apache Cassandra and Apache Kafka
Webinar  |  Better Together: Apache Cassandra and Apache KafkaWebinar  |  Better Together: Apache Cassandra and Apache Kafka
Webinar | Better Together: Apache Cassandra and Apache Kafka
 
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax EnterpriseTop 10 Best Practices for Apache Cassandra and DataStax Enterprise
Top 10 Best Practices for Apache Cassandra and DataStax Enterprise
 
Introduction to Apache Cassandra™ + What’s New in 4.0
Introduction to Apache Cassandra™ + What’s New in 4.0Introduction to Apache Cassandra™ + What’s New in 4.0
Introduction to Apache Cassandra™ + What’s New in 4.0
 
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
Webinar: How Active Everywhere Database Architecture Accelerates Hybrid Cloud...
 
Webinar | Aligning GDPR Requirements with Today's Hybrid Cloud Realities
Webinar  |  Aligning GDPR Requirements with Today's Hybrid Cloud RealitiesWebinar  |  Aligning GDPR Requirements with Today's Hybrid Cloud Realities
Webinar | Aligning GDPR Requirements with Today's Hybrid Cloud Realities
 
Designing a Distributed Cloud Database for Dummies
Designing a Distributed Cloud Database for DummiesDesigning a Distributed Cloud Database for Dummies
Designing a Distributed Cloud Database for Dummies
 
How to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
How to Power Innovation with Geo-Distributed Data Management in Hybrid CloudHow to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
How to Power Innovation with Geo-Distributed Data Management in Hybrid Cloud
 
How to Evaluate Cloud Databases for eCommerce
How to Evaluate Cloud Databases for eCommerceHow to Evaluate Cloud Databases for eCommerce
How to Evaluate Cloud Databases for eCommerce
 
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
Webinar: DataStax Enterprise 6: 10 Ways to Multiply the Power of Apache Cassa...
 
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
Webinar: DataStax and Microsoft Azure: Empowering the Right-Now Enterprise wi...
 
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
Webinar - Real-Time Customer Experience for the Right-Now Enterprise featurin...
 
Datastax - The Architect's guide to customer experience (CX)
Datastax - The Architect's guide to customer experience (CX)Datastax - The Architect's guide to customer experience (CX)
Datastax - The Architect's guide to customer experience (CX)
 
An Operational Data Layer is Critical for Transformative Banking Applications
An Operational Data Layer is Critical for Transformative Banking ApplicationsAn Operational Data Layer is Critical for Transformative Banking Applications
An Operational Data Layer is Critical for Transformative Banking Applications
 
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design ThinkingBecoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
Becoming a Customer-Centric Enterprise Via Real-Time Data and Design Thinking
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 

Recently uploaded (20)

OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 

Storing Cassandra Metrics (Chris Lohfink, DataStax) | C* Summit 2016

  • 2. About me • Software developer at DataStax • OpsCenter, Metrics & Cassandra interactions © DataStax, All Rights Reserved. 2
  • 3. What this talk is • What does the thing the metrics report mean (da dum tis) • How metrics evolved in C* © DataStax, All Rights Reserved. 3
  • 4. Collecting Not how, but what and why
  • 5. Cassandra Metrics • For the most part metrics do not break backwards compatibility • Until they do (from deprecation or bugs) • Deprecated metrics are hard to identify without looking at source code, so their disappearance may have surprising impacts even if deprecated for years. • i.e. Cassandra 2.2 removal of “Recent Latency” metrics © DataStax, All Rights Reserved. 5
  • 6. C* Metrics Pre-1.1 © DataStax, All Rights Reserved. 6 • Classes implemented MBeans and metrics were added in place • ColumnFamilyStore -> ColumnFamilyStoreMBean • Semi-adhoc, tightly coupled to code but had a “theme” or common abstractions
  • 7. Latency Tracker • LatencyTracker stores: • recent histogram • total histogram • number of ops • total latency • Use latency/#ops since last time called to compute “recent” average latency • Every time queried it will reset the latency and histogram. © DataStax, All Rights Reserved. 7
  • 8. Describing Latencies © DataStax, All Rights Reserved. 8 0 100 200 300 400 500 600 700 800 900 1000 • Listing the raw the values: 13ms, 14ms, 2ms, 13ms, 90ms, 734ms, 8ms, 23ms, 30ms • Doesn’t scale well • Not easy to parse, with larger amounts can be difficult to find high values
  • 9. Describing Latencies © DataStax, All Rights Reserved. 9 0 100 200 300 400 500 600 700 800 900 1000 • Average: • 103ms
  • 10. Describing Latencies © DataStax, All Rights Reserved. 10 0 100 200 300 400 500 600 700 800 900 1000 • Average: • 103ms
  • 11. Describing Latencies © DataStax, All Rights Reserved. 11 0 100 200 300 400 500 600 700 800 900 1000 • Average: • 103ms • Missing outliers
  • 12. Describing Latencies © DataStax, All Rights Reserved. 12 0 100 200 300 400 500 600 700 800 900 1000 • Average: • 103ms • Missing outliers • Max: 734ms • Min: 2ms
  • 13. Describing Latencies © DataStax, All Rights Reserved. 13 0 100 200 300 400 500 600 700 800 900 1000 • Average: • 103ms • Missing outliers • Max: 734ms • Min: 2ms
  • 14. Latency Tracker • LatencyTracker stores: • recent histogram • total histogram • number of ops • total latency • Use latency/#ops since last time called to compute “recent” average latency • Every time queried it will reset the latency and histogram. © DataStax, All Rights Reserved. 14
  • 15. Recent Average Latencies © DataStax, All Rights Reserved. 15 0 100 200 300 400 500 600 700 800 900 1000 • Reported latency from • Sum of latencies since last called • Number of requests since last called • Average: • 103ms • Outliers lost
  • 16. Histograms • Describes frequency of data © DataStax, All Rights Reserved. 16 1, 2, 1, 1, 3, 4, 3, 1
  • 17. Histograms • Describes frequency of data 1 © DataStax, All Rights Reserved. 17 1, 2, 1, 1, 3, 4, 3, 1
  • 18. Histograms • Describes frequency of data 1 2 © DataStax, All Rights Reserved. 18 1, 2, 1, 1, 3, 4, 3, 1
  • 19. Histograms • Describes frequency of data 11 2 © DataStax, All Rights Reserved. 19 1, 2, 1, 1, 3, 4, 3, 1
  • 20. Histograms • Describes frequency of data 111 2 © DataStax, All Rights Reserved. 20 1, 2, 1, 1, 3, 4, 3, 1
  • 21. Histograms • Describes frequency of data 111 2 3 © DataStax, All Rights Reserved. 21 1, 2, 1, 1, 3, 4, 3, 1
  • 22. Histograms • Describes frequency of data 111 2 3 4 © DataStax, All Rights Reserved. 22 1, 2, 1, 1, 3, 4, 3, 1
  • 23. Histograms • Describes frequency of data 111 2 33 4 © DataStax, All Rights Reserved. 23 1, 2, 1, 1, 3, 4, 3, 1
  • 24. Histograms • Describes frequency of data 1111 2 33 4 © DataStax, All Rights Reserved. 24 1, 2, 1, 1, 3, 4, 3, 1
  • 25. Histograms • Describes frequency of data 1111 2 33 4 © DataStax, All Rights Reserved. 25 1, 2, 1, 1, 3, 4, 3, 1 0 1 2 3 4 4 3 2 1 Count
  • 26. Histograms • "bin" the range of values • divide the entire range of values into a series of intervals • Count how many values fall into each interval © DataStax, All Rights Reserved. 26
  • 27. Histograms • "bin" the range of values—that is, divide the entire range of values into a series of intervals—and then count how many values fall into each interval © DataStax, All Rights Reserved. 27 0 100 200 300 400 500 600 700 800 900 1000 13, 14, 2, 20, 13, 90, 734, 8, 53, 23, 30
  • 28. Histograms • "bin" the range of values—that is, divide the entire range of values into a series of intervals—and then count how many values fall into each interval © DataStax, All Rights Reserved. 28 13, 14, 2, 20, 13, 90, 734, 8, 53, 23, 30
  • 29. Histograms • "bin" the range of values—that is, divide the entire range of values into a series of intervals—and then count how many values fall into each interval © DataStax, All Rights Reserved. 29 2, 8, 13, 13, 14, 20, 23, 30, 53, 90, 734
  • 30. Histograms • "bin" the range of values—that is, divide the entire range of values into a series of intervals—and then count how many values fall into each interval © DataStax, All Rights Reserved. 30 2, 8, 13, 13, 14, 20, 23, 30, 53, 90, 734 1-10 11-100 101-1000 2 8 1
  • 31. Histograms Approximations Max: 1000 (actual 734) © DataStax, All Rights Reserved. 31 1-10 11-100 101-1000 2 8 1
  • 32. Histograms Approximations Max: 1000 (actual 734) Min: 10 (actual 2) © DataStax, All Rights Reserved. 32 1-10 11-100 101-1000 2 8 1
  • 33. Histograms Approximations Max: 1000 (actual 734) Min: 10 (actual 2) Average: sum / count, (10*2 + 100*8 + 1000*1) / (2+8+1) = 165 (actual 103) © DataStax, All Rights Reserved. 33 1-10 11-100 101-1000 2 8 1
  • 34. Histograms Approximations Max: 1000 (actual 734) Min: 10 (actual 2) Average: sum / count, (10*2 + 100*8 + 1000*1) / (2+8+1) = 165 (actual 103) Percentiles: 11 requests, so we know 90 percent of the latencies occurred in the 11-100 bucket or lower. 90th Percentile: 100 © DataStax, All Rights Reserved. 34 1-10 11-100 101-1000 2 8 1
  • 35. Histograms Approximations Max: 1000 (actual 734) Min: 10 (actual 2) Average: sum / count, (10*2 + 100*8 + 1000) / (2+8+1) = 165 (actual 103) Percentiles: 11 requests, so we know 90 percent of the latencies occurred in the 11-100 bucket or lower. 90th Percentile: 100 © DataStax, All Rights Reserved. 35 1-10 11-100 101-1000 2 8 1
  • 36. EstimatedHistogram The series starts at 1 and grows by 1.2 each time 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 17, 20, 24, 29, … 12108970, 14530764, 17436917, 20924300, 25109160 © DataStax, All Rights Reserved. 36
  • 37. LatencyTracker Has two histograms • Recent • Count of times a latency occurred since last time read for each bin • Total • Count of times a latency occurred since Cassandra started for each bin © DataStax, All Rights Reserved. 37
  • 38. Total Histogram Deltas If you keep track of histogram last time you read it can find delta to determine how many occurred in that interval Last Now © DataStax, All Rights Reserved. 38 1-10 11-100 101-1000 2 8 1 1-10 11-100 101-1000 4 8 2
  • 39. Total Histogram Deltas If you keep track of histogram last time you read it can find delta to determine how many occurred in that interval Last Now Delta © DataStax, All Rights Reserved. 1-10 11-100 101-1000 2 8 1 1-10 11-100 101-1000 4 8 2 1-10 11-100 101-1000 2 0 1
  • 40. Cassandra 1.1 • Yammer/Codahale/Dropwizard Metrics introduced • Awesome! • Not so awesome… © DataStax, All Rights Reserved. 40
  • 41. Reservoirs • Maintain a sample of the data that is representative of the entire set. • Can perform operations on the limited, fixed memory set as if on entire dataset • Vitters Algorithm R • Offers a 99.9% confidence level & 5% margin of error • Simple • Randomly include value in reservoir, less and less likely as more values seen © DataStax, All Rights Reserved. 41
  • 42. Reservoirs • Maintain a sample of the data that is representative of the entire set. • Can perform operations on the limited, fixed memory set as if on entire dataset • Vitters Algorithm R • Offers a 99.9% confidence level & 5% margin of error * When the stream has a normal distribution © DataStax, All Rights Reserved. 42
  • 43. Metrics Reservoirs • Random sampling, what can it miss? – Min – Max – Everything in 99th percentile? – The more rare, the less likely to be included 43
  • 44. Metrics Reservoirs • “Good enough” for basic adhoc viewing but too non-deterministic for many • Commonly resolved using replacement reservoirs (i.e. HdrHistogram) 44
  • 45. Metrics Reservoirs • “Good enough” for basic adhoc viewing but too non-deterministic for many • Commonly resolved using replacement reservoirs (i.e. HdrHistogram) – org.apache.cassandra.metrics.EstimatedHistogramReservoir 45
  • 46. Cassandra 2.2 • CASSANDRA-5657 – upgrade metrics library (and extend it) – Replaced reservoir with EH • Also exposed raw bin counts in values operation – Deleted deprecated metrics • Non EH latencies from LatencyTracker 46
  • 47. Cassandra 2.2 • No recency in histograms • Requires delta’ing on the total bin counts currently which is beyond some simple tooling • CASSANDRA-11752 (fixed 2.2.8, 3.0.9, 3.8) 47
  • 49. Storing the data • We have data, now to store it. Approaches tend to follow: – Store all data points • Provide aggregations either pre-computed as entered, MR, or on query – Round Robin Database • Only store pre-computed aggregations • Choice depends heavily on requirements 49
  • 50. Round Robin Database • Store state required to generate the aggregations, and only store the aggregations – Sum & Count for Average – Current min, max – “One pass” or “online” algorithms • Constant footprint 50
  • 51. Round Robin Database • Store state required to generate the aggregations, and only store the aggregations – Sum & Count for Average – Current min, max – “One pass” or “online” algorithms • Constant footprint 51 60 300 3600 Sum 0 0 0 Count 0 0 0 Min 0 0 0 Max 0 0 0
  • 52. Round Robin Database > 10ms @ 00:00 52 60 300 3600 Sum 10 10 10 Count 1 1 1 Min 10 10 10 Max 10 10 10
  • 53. Round Robin Database > 10ms @ 00:00 > 12ms @ 00:30 53 60 300 3600 Sum 22 22 22 Count 2 2 2 Min 10 10 10 Max 12 12 12
  • 54. Round Robin Database > 10ms @ 00:00 > 12ms @ 00:30 > 14ms @ 00:59 54 60 300 3600 Sum 36 36 36 Count 3 3 3 Min 10 10 10 Max 14 14 14
  • 55. Round Robin Database > 10ms @ 00:00 > 12ms @ 00:30 > 14ms @ 00:59 > 13ms @ 01:10 55 60 300 3600 Sum 36 36 36 Count 3 3 3 Min 10 10 10 Max 14 14 14
  • 56. Round Robin Database > 10ms @ 00:00 > 12ms @ 00:30 > 14ms @ 00:59 > 13ms @ 01:10 56 60 300 3600 Sum 36 36 36 Count 3 3 3 Min 10 10 10 Max 14 14 14 Average 12 Min 10 Max 14
  • 57. Round Robin Database > 10ms @ 00:00 > 12ms @ 00:30 > 14ms @ 00:59 > 13ms @ 01:10 57 60 300 3600 Sum 0 36 36 Count 0 3 3 Min 0 10 10 Max 0 14 14
  • 58. Round Robin Database > 10ms @ 00:00 > 12ms @ 00:30 > 14ms @ 00:59 > 13ms @ 01:10 58 60 300 3600 Sum 13 49 49 Count 1 4 4 Min 13 10 10 Max 13 14 14
  • 59. Max is a lie • The issue with the deprecated LatencyTracker metrics is that the 1 minute interval does not have a min/max. So we cannot compute true min/max the rollups min/max will be the minimum and maximum average 59
  • 60. Histograms to the rescue (again) • The histograms of the data does not have this issue. But storage is more complex. Some options include: – Store each bin of the histogram as a metric – Store the percentiles/min/max each as own metric – Store raw long[90] (possibly compressed) 60
  • 61. Histogram Storage Size • Some things to note: – “Normal” clusters have over 100 tables. – Each table has at least two histograms we want to record • Read latency • Write latency • Tombstones scanned • Cells scanned • Partition cell size • Partition cell count 61
  • 62. Histogram Storage Because we store the extra histograms we have a 600 (minimum) with upper bounds seen to be over 24,000 histograms per minute. • Storing 1 per bin means [54000] metrics (expensive to store, expensive to read) • Storing raw histograms is [600] metrics • Storing min, max, 50th, 90th, 99th is [3000] metrics – Additional problems with this • Cant compute 10th, 95th, 99.99th etc • Aggregations 62
  • 63. Aggregating Histograms Averaging the percentiles [ INSERT DISAPOINTED GIL TENE PHOTO ] © DataStax, All Rights Reserved. 63
  • 64. Aggregating Histograms • Consider averaging the maximum If there is a node with a 10 second GC, but the maximum latency on your other 9 nodes is 60ms. If you report a “Max 1 second” latency, it would be misleading. • Poor at representing hotspots affects on your application One node in 10 node raspberry pi cluster gets 1000 write reqs/sec while others get 10 reqs/sec. The 1 node being under heavy stress has a 90th percentile of 10 second. The other nodes are basically sub ms and writes are taking 1ms on 90th percentile. Would report a 1 second 90th percentile, even though 10% of our applications writes are taking >10 seconds © DataStax, All Rights Reserved. 64
  • 65. Aggregating Histograms Merging histograms from different nodes more accurately can be straight forward: Node1 Node2 Cluster © DataStax, All Rights Reserved. 65 1-10 11-100 101-1000 2 8 1 1-10 11-100 101-1000 2 1 5 1-10 11-100 101-1000 4 9 6
  • 66. Histogram Storage Because we store the extra histograms we have a 600 (minimum) with upper bounds seen to be over 24,000 histograms per minute. • Storing 1 per bin means [54000] metrics (expensive to store, expensive to read) • Storing raw histograms is [600] metrics • Storing min, max, 50th, 90th, 99th is [3000] metrics – Additional problems with this • Cant compute 10th, 95th, 99.99th etc • Aggregations 66
  • 67. Raw Histogram storage • Storing raw histograms 160 (default) longs is a minimum of 1.2kb bytes per rollup and hard sell – 760kb per minute (600 tables) – 7.7gb for the 7 day TTL we want to keep our 1 min rollups at – ~77gb with 10 nodes – ~2.3 Tb on 10 node clusters with 3k tables – Expired data isn’t immediately purged so disk space can be much worse 67
  • 68. Raw Histogram storage • Goal: We wanted this to be comparable to other min/max/avg metric storage (12 bytes each) – 700mb on expected 10 node cluster – 2gb on extreme 10 node cluster • Enter compression 68
  • 69. Compressing Histograms • Overhead of typical compression makes it a non-starter. – headers (ie 10 bytes for gzip) alone nearly exceeds the length used by existing rollup storage (~12 bytes per metric) • Instead we opt to leverage known context to reduce the size of the data along with some universal encoding. 69
  • 70. Compressing Histograms • Instead of storing every bin, only store the value of each bin with a value > 0 since most bin will have no data (ie, very unlikely for a read histogram to be between 1-10 microseconds which is first 10 bins) • Write the count of offset/count pairs • Use varint for the bin count – To reduce the value of the varint as much as possible we sort the offset/count pairs by the count and represent it as a delta sequence 70
  • 71. Compressing Histograms 0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 71 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte 1 byte
  • 72. Compressing Histograms 0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 72 7
  • 73. Compressing Histograms 0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 {4:1, 8:100, 11:9999999, 14:1, 15:127, 16:128 17:129} 73 7
  • 74. Compressing Histograms 0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 {4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999} 74 7
  • 75. Compressing Histograms 0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 {4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999} 75 7 4 1
  • 76. Compressing Histograms 0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 {4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999} 76 7 4 1 14 0
  • 77. Compressing Histograms 0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 {4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999} 77 7 4 1 14 0 8 99
  • 78. Compressing Histograms 0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 {4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999} 78 7 4 1 14 0 8 99 15 27
  • 79. Compressing Histograms 0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 {4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999} 79 7 4 1 14 0 8 99 15 27 16 1 17 1
  • 80. Compressing Histograms 0 0 0 0 1 0 0 0 100 0 0 9999999 0 0 1 127 128 129 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 {4:1, 14:1, 8:100, 15:127, 16:128, 17:129, 11:9999999} 80 7 4 1 14 0 8 99 15 27 16 1 17 1 11 9999870
  • 81. Compressing Histograms Real Life** results of compression: 81 Size in bytes Median 1 75th 3 95th 15 99th 45 Max** 124
  • 82. Note on HdrHistogram • Comes up every couple months • Very awesome histogram, popular replacement for Metrics reservoir. – More powerful and general purpose than EH – Only slightly slower for all it offers A issue comes up a bit with storage: • Logged HdrHistograms are ~31kb each (30,000x more than our average use) • Compressed version: 1kb each • Perfect for many many people when tracking 1 or two metrics. Gets painful when tracking hundreds or thousands 82