P50/P95/P99 Latency Percentiles
Data Pipelines, Monitoring & Reliability DS practice problem on Onlearn.
Difficulty: easy.
Topics: P50/P95/P99 Latency Percentiles, P99 Tail Latency, Histogram Binning, Moving Average Smoothing, Outlier Detection, Service Level Objectives (SLOs), Distributed Systems Architecture, Statistical Analysis, Observability and Monitoring, Performance Engineering, Service Level Management, Queueing Theory, Time-Series Aggregation, Latency Distribution Modeling, Infrastructure Telemetry, Reliability Engineering.
Implement a function that calculates the P50, P95, and P99 latency percentiles from a list of latency measurements. These percentiles are critical metrics for monitoring system performance, API response times, and model inference latencies in production ML systems. The function should take a list of latency values (in milliseconds or any time unit) and return a dictionary containing the 50th, 95th, and 99th percentile values, each rounded to 4 decimal places. Specifications: P50 (median): The value below which 50% of observations fall P95: The value below which 95% of observations fall P99: The value below which 99% of observations fall Use linear interpolation for percentile calculation If the input list is empty, return all percentiles as 0.0 Return values should be rounded to 4 decimal places