Skip to content

Percentiles

How fast something answers for most people and for the unlucky few: the median (p50) and the slow tail (p95, p99) over time, on one axis.

import { Percentiles, ChartSkeleton } from '@sypnia/ui/react'

On this page
  1. Response time over a week
  2. Skeleton
  3. When to use it
  4. For everyone
  5. Props

Response time over a week

Response time of /orders
Milliseconds, last 7 days
  • p50
  • p95
  • p99
0 ms1 sec2 sec3 secNov 11Nov 12Nov 13Nov 14Nov 15Nov 16Nov 17p50p95p99
View as table
Dayp50p95p99
Nov 11118 ms410 ms880 ms
Nov 12122 ms430 ms940 ms
Nov 13125 ms520 ms1.6 sec
Nov 14119 ms405 ms860 ms
Nov 15131 ms610 ms2.1 sec
Nov 16128 ms480 ms1.1 sec
Nov 17124 ms452 ms990 ms
Code
import { Percentiles } from '@sypnia/ui/react';

// The median and the slow tail on one axis. The band is the spread between p50 and p99.
const days = ['Nov 11', 'Nov 12', 'Nov 13', 'Nov 14', 'Nov 15', 'Nov 16', 'Nov 17'];
export default function Latency() {
  return (
    <Percentiles title="Response time of /orders" subtitle="Milliseconds, last 7 days" xLabel="Day" x={days}
      p50={[118, 122, 125, 119, 131, 128, 124]} p95={[410, 430, 520, 405, 610, 480, 452]} p99={[880, 940, 1600, 860, 2100, 1050, 990]} />
  );
}

Skeleton

Code
import { ChartSkeleton } from '@sypnia/ui/react';

// The chart before its numbers come: the axes and a legend for three lines.
export default function Skeleton() {
  return <ChartSkeleton legend={3} />;
}

When to use it

Use it when

  • Response times of an endpoint, a query, a page.
  • Watch the p99: it is what the slowest one in a hundred lives through.

Do not use it when

  • Averages: they hide the slow tail.
  • Values that are not times or sizes.

For everyone

  • Each line is named at its end and in the legend; the tooltip reads every percentile at once.
  • «View as table» has every value.

Props

PercentilesTypeDefault
p50required (number | null)[]
titlerequired ReactNode
xrequired string[]
empty ReactNode
error ReactNode
formatValue

Defaults to milliseconds, written the person's way: 840 ms, 1.2 s.

Fmt
height number
loading boolean
p90 (number | null)[]
p95 (number | null)[]
p99 (number | null)[]
subtitle

What is plotted and in what unit: «Requests per minute, last 24 hours».

ReactNode
xLabel string
ChartSkeletonTypeDefault
height number 240
legend

How many series the legend will list.

number 0
table

Whether the chart will offer «View as table» under the plot (every LineChart, AreaChart and BarChart does).

boolean true
  1. Response time over a week
  2. Skeleton
  3. When to use it
  4. For everyone
  5. Props

    Search pages, sections and terms