Menu

Latency percentiles: why the mean, averaged p99s and naive load tests mislead
📰

Latency percentiles: why the mean, averaged p99s and naive load tests mislead

DEV Community: cpp·Academic Quant·8 days ago
#dcNQcFUO
#devtocpp#devto#dev#latency#messages
Long article (597 words) — no AI summary yet.
Reading 0:00
15s threshold

If you're asked in an interview how you'd report the latency of a trading system (or of any service, really), the answer the interviewer is hoping for isn't "the average", and I simulated a day of messages to show why. All the numbers below come from that one run.

The simulated day has 24 hours of 100,000 messages each, so 2.4 million in all. Most messages take about 2 µs, a small share of them hit something slow such as a cache miss or an interrupt, and one hour in the afternoon is busy and has a much heavier tail than the rest.

Measure Value

Mean 2.12 µs

Median (p50) 2.00 µs

p99 2.91 µs

p99.9 34.5 µs

Max 413.7 µs

The mean sits right next to the median and tells you almost nothing about the tail, while the p99.9 is more than ten times the p99, which is where the trouble actually is. In trading the slow moments tend to be the busy and volatile ones, and those are exactly the moments when being fast earns money.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.