Is the "mean" of a Timer represent "recent" activity

433 views
Skip to first unread message

David Tauzell

unread,
Nov 13, 2012, 5:38:18 PM11/13/12
to metric...@googlegroups.com
Timers use "biased" histograms.  Does that mean that the "mean" property roughly represents the last 5 minutes as opposed to a mean over the entire life of the Timer?

Coda Hale

unread,
Nov 13, 2012, 7:00:31 PM11/13/12
to metric...@googlegroups.com
No, the mean is the mean for the timer's lifetime.

---
Coda Hale
http://codahale.com

David Tauzell

unread,
Nov 13, 2012, 8:11:05 PM11/13/12
to metric...@googlegroups.com
Ok, thanks.  So to get a "five minute" mean, I'll have to capture total requests + total time in two metrics and then use something like Graphite to do the calculation. 

-Dave

Coda Hale

unread,
Nov 13, 2012, 10:06:11 PM11/13/12
to metric...@googlegroups.com
Well, you could just calculate the mean from a timer's snapshot.

In general, though, I'd recommend against using the arithmetic mean of a latency curve to help you make any decisions. It's not a helpful metric and you should use quantiles instead if you want a saner measure of centrality.

For example, a set containing 99 1ms measurements and a single 100ms measurement has an arithmetic mean of ~2ms. But because it's not normally distributed, this tells you fuck-all about what's actually going on: the standard deviation of that set is ~10ms.

In contrast, looking at the p95 (1ms), the p99 (2ms), and the p999 (100ms) tells you that instead of being a process which usually takes 2ms, it's a process which almost always takes 1ms but occasionally takes 100ms.

From there you know to focus on rare events (e.g., garbage collection, dropped packets, IO schedulers) instead of common events (e.g., suboptimal algorithms, unoptimized code). It's the difference between solving the problem and wasting time.

---
Coda Hale
http://codahale.com



David Tauzell

unread,
Nov 14, 2012, 10:17:24 AM11/14/12
to metric...@googlegroups.com
Thanks!  You've sold me on using the quantiles and from what I can tell the quantiles are biased towards recent data.

-Dave

Raman Shakya

unread,
Jul 1, 2015, 12:06:54 PM7/1/15
to metric...@googlegroups.com
I was looking on the Exponentially Decaying Reservoir which seems to be default implementation for the metrics. In that case, is the mean not biased towards the most recent values in last 5 mins??

Raman
Reply all
Reply to author
Forward
0 new messages