>_ IzzyLab

Hands-on task

This task is step 13 of the course “Monitoring and metrics”

Response time p95

medium~7 min

In /root/latency.txt there is one number per line (a little over a hundred values — response times in ms). Compute the 95th percentile using the nearest-rank method (sort ascending, index = ceil(0.95 × N)) and write it to /root/p95.txt.

What you'll practise:
  • p95 percentile
  • nearest-rank
  • sort -n
  • awk
  • ceil

Topic breakdown

The p95 percentile is the value below which 95% of observations fall; it is watched instead of the average because the average smears out the "tail" of rare slow requests. The nearest-rank method: sort ascending and take the element at index ceil(p/100 × N) with numbering from one — for non-round N rounding up is fundamental. The data is stored shuffled, so numeric (not textual!) sorting before selection is mandatory.

What's checked

  1. p95 is correct

What it looks like