Question: What is the difference between p50 and p99 latency?

Answer

In performance monitoring, specifically when dealing with latencies, we often come across percentiles such as P50, P90, P95, P99, etc. These percentile values help us understand the distribution of latency values.

P50 is the median value in a series of data points. When talking about latency, it means that 50% of requests were processed faster than this value, and 50% took longer. For instance, if the P50 latency is 200ms, it indicates that half of the requests were processed in less than 200 milliseconds, and the other half took more time.

On the other hand, P99 represents the 99th percentile latency. It shows that 99% of requests were processed faster than this value, and only 1% took longer. In our context, if the P99 latency is 800ms, it indicates that 99% of the requests were processed in less than 800 milliseconds, while 1% took more time.

The gap between P50 and P99 can be significant based on how your system behaves under load or during peak times. If the gap is too large, it might mean that there are outliers or spikes in your latency under some conditions, which could impact user experience.

You can use these metrics to identify potential bottlenecks in your application. They can be used together for a comprehensive understanding of your application's performance characteristics.

Here's an example code for calculating these values using Python:

import numpy # Let's say these are the latency measurements latencies = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000] # Calculate the P50 (median) p50 = numpy.percentile(latencies, 50) print("P50 latency is ", p50, "ms") # Calculate the P99 p99 = numpy.percentile(latencies, 99) print("P99 latency is ", p99, "ms")

Keep in mind that while P50 provides a general idea about your system's performance, P99 helps you understand the experience of the slowest users. Both are critical for evaluating the true end-user experience.

Was this content helpful?

White Paper

Free System Design on AWS E-Book

Download this early release of O'Reilly's latest cloud infrastructure e-book: System Design on AWS.

Free System Design on AWS E-Book
Start building today

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.