This is interesting, but the author doesn’t explain why this is true, other than the term “t-weighted” and an equation, neither of which make sense to me. I wish they’d explained it more clearly for people like me who’ve long since forgotten their college statistics class.
Say you have a monitoring dashboard. There, you'd normally compute the mean latency by treating every request equally:
mean = (sum of all latencies) / (number of requests)
That's E[X]. Each request gets weight 1/N.
Alice's experience of the latency is in terms of time (which is where I think the "t-weighted" is coming from).
Say Alice makes M requests with latencies x_1, x_2, ..., x_M.
If you ask "during a randomly chosen second of Alice's total waiting time, what's the latency of the request she's waiting on?" each request i contributes a fraction x_i / (Σ_j x_j). (so longer requests contribute more)
As a simple worked out example: if there are two requests, one with latency 1s and one with latency 10s, then the average is 5.5s, but the time-weighted average would be 1 * (1 / 11) + 10 * 10 / 11 = 9.18s.
snej | 3 hours ago
This is interesting, but the author doesn’t explain why this is true, other than the term “t-weighted” and an equation, neither of which make sense to me. I wish they’d explained it more clearly for people like me who’ve long since forgotten their college statistics class.
typesanitizer | 3 hours ago
Say you have a monitoring dashboard. There, you'd normally compute the mean latency by treating every request equally:
That's
E[X]. Each request gets weight1/N.Alice's experience of the latency is in terms of time (which is where I think the "t-weighted" is coming from).
Say Alice makes M requests with latencies
x_1, x_2, ..., x_M.If you ask "during a randomly chosen second of Alice's total waiting time, what's the latency of the request she's waiting on?" each request i contributes a fraction
x_i / (Σ_j x_j). (so longer requests contribute more)So the time-weighted average is:
As a simple worked out example: if there are two requests, one with latency 1s and one with latency 10s, then the average is 5.5s, but the time-weighted average would be
1 * (1 / 11) + 10 * 10 / 11 = 9.18s.typesanitizer | 6 hours ago
Perhaps needs retitling to something more informative like "Latency and the inspection paradox"? The current title basically conveys 0 information 😅