What is p50 p90 p99 latency?

Hey, what’s up, everybody. In this article, I will be talking about what latency is, how it is measured and how these metrics are important to you as a developer.
Before answering this question to the title, it is mandatory to understand the concept of latency.

Join our discord server for more such content 

The story

Feel free to skip to the main content, here I’m gonna talk about how I got introduced to this topic.

So one fine day my team lead asked me to check the latencies of our services on the APM. As escalations had raised that some of our services are not able to handle the load; and it resulted in the increase of latencies.

Me in my mind: what are these latencies? Where do I find them?

After some google searches, I found my answer and shared the screenshot. Unlike any other engineer, my engineering brain was not satisfied with just the data sharing. Again, I did some google searches, read some articles, and figured out all about latency and p50 p90 p99 latency metrics.

That’s all about my story. Let’s get into action now.

What is latency?

Latency is the total time taken for the data to reach its destination. This time is usually the round-trip time.

In simple words,

  1. the client requests server.
  2. the server responds to the client.

The most awaited answer

p50, p90, pxx are metrics to measure the latency of your services. The number here denotes the percentile of total requests.

p50 – The 50th latency percentile: 50% of the requests will be faster than the p50 value.
p90 – The 90th latency percentile: 90% of the requests will be faster than the p90 value.

Let’s take an example to simplify this further.

Say we have the following latencies in milliseconds:
50, 78, 25, 90, 102, 68.

Now arrange them in ascending order, and you get.
25, 50, 68, 78, 90, 102.

the p50 latency for this will be the next latency after skipping the first 50% of data i.e. 78.
Similarly, p90 = 102.

Also read, Blue-Green Deployment (A sure shot way to reduce downtime in deployment)

Let’s see if you got the example, comment down below the p75 for the above example.

What is the significance of p50 p90 p99 latency?

The lower the values of these metrics the better your service is performing. The order of precedence for these will be in descending order i.e. p99, p90, p50.
So the lower the values of p99, p90 the better your service / APIs are.

References

https://medium.com/@djsmith42/how-to-metric-edafaf959fc7

https://stackoverflow.com/questions/12808934/what-is-p99-latency

Follow readosapien for more such backend engineering concepts.

Leave a Comment