Skip to content

Request Performance (P50, P95, P99)

This query analyzes the latency of incoming requests to your application, providing a breakdown of median and tail latency. Monitoring percentiles helps identify performance issues that affect only a small portion of users but may indicate significant underlying problems.

Scenario

You need to identify endpoints experiencing high latency and understand the difference between typical performance and worst-case scenarios for your users.

KQL Query

requests
| where timestamp > ago(24h)
| summarize 
    AvgDuration = avg(duration), 
    P50 = percentile(duration, 50), 
    P95 = percentile(duration, 95), 
    P99 = percentile(duration, 99), 
    Count = count() 
    by name
| order by P99 desc

Data Flow

graph TD
    A[requests table] --> B[Filter by 24h]
    B --> C[Group by name]
    C --> D[Calculate percentiles]
    D --> E[Order by P99]

Sample Output

name AvgDuration P50 P95 P99 Count
GET /api/Search 450.2 320.0 1200.0 3500.0 1500
POST /api/Checkout 120.5 110.0 250.0 800.0 450
GET /home/index 45.3 40.0 95.0 150.0 12000

How to Read This

Focus on the gap between P50 and P99. A large disparity (e.g., P50 is 300ms but P99 is 3.5s) suggests that while most users have a good experience, some encounter significant delays, often due to resource contention or cold starts.

Limitations

  • Percentiles require a sufficient volume of data to be statistically significant.
  • duration in Application Insights is measured in milliseconds.
  • This query does not account for client-side latency (network transit).

Common Variations

By time window

requests
| where timestamp > ago(1h)
| summarize P50 = percentile(duration, 50), P95 = percentile(duration, 95), P99 = percentile(duration, 99), Count = count() by name
| order by P99 desc

Grouped by cloud role

requests
| where timestamp > ago(24h)
| summarize P95 = percentile(duration, 95), P99 = percentile(duration, 99), Count = count() by cloud_RoleName, name
| order by P99 desc

Interpretation Guide

Pattern Indicates Action
P99 much higher than P50 Tail latency issue Check cold starts, retries, and dependency spikes
P50, P95, and P99 all elevated Systemic slowness Check CPU, memory, thread pool, and database pressure
Low count with extreme P99 Outlier-heavy endpoint Validate whether a few failing requests skew results

For the full investigation workflow, see Missing Application Telemetry.

See Also

Sources