Introducing Dragonfly Cloud! Learn More

Question: What is p95 latency?


P95 latency, also known as the 95th percentile of latency, is a statistical measure used in computer network performance analysis. It essentially indicates that 95% of requests to a system were served faster than this value, while 5% took longer.

In practical terms, it's often used to identify the experience of outliers in system performance. While average or median latencies can provide an overall view of system performance, they may obscure the experience of users who encounter much slower response times. P95, and other percentile measures like P99, help to highlight these potentially problematic scenarios.

Here's a simple example with Python using the numpy library:

import numpy as np # let's say these are latencies in milliseconds latencies = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] p95_latency = np.percentile(latencies, 95) print(p95_latency) # 95.0

In this case, we see that 95% of our latencies are below or equal to 95ms, meaning that only 5% of requests experienced latencies higher than 95ms.

With real latency data from a system, you can use similar calculations to identify your P95 latency, which can then be used to optimize for better performance, especially focusing on those worst-case scenarios.

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.