Know the difference: average, median and percentiles
Such notations are widely employed in analytical and monitoring tools such as Grafana or New Relic. They are primarily used to measure response time, latency, throughput, or similar metrics. Let's examine each of them:
Average or Avg - This is the arithmetic mean, calculated by summing up all the values and then dividing this total by the number of elements.
Median (or p50) - In this case, all the given values are sorted by their magnitude, and the halfway point is chosen. For instance, if the p50 value is 219ms, it indicates that 50% of the monitored requests for the given period were completed in 219ms or less.
P90 (or 90th percentile) - Similar to p50, but this time it represents 90% of the requests.
Practical Recommendation
In the provided example you can observe a substantial and less obvious difference between P50 and the average:
Data set 1 | Data set 2 | |
---|---|---|
1 | 1 | |
1 | 1 | |
1 | 1 | |
2 | 2 | |
2 | 2 | |
2 | 2 | |
3 | 3 | |
3 | 3 | |
3 | 3 | |
10 | 100 | |
Total | 28 | 118 |
Average | 2,8 | 11,8 |
P50 (Median) | 2 | 2 |
P99 | 9,44 | 92,24 |
In the example provided, the data set is almost the same, except for the last value. In data set 1, the last value is 10, while in the 2nd data set, it's – 100. Please note that this change hasn't affected the median value, but the average is now different.
Usage in Excel documents
Excel has built-in functions for such metrics:
Avg: =AVERAGE(C2:C11)
P50: =PERCENTILE.INC(C2:C11;50%)
P99: =PERCENTILE.INC(C3:C11;99%)
Conclusion
So if you intend to utilize captured metrics for performance analysis, it is advisable to pay more attention to the P** metrics, and in general know the difference.