# Lorenz and Little: How Much Does Your Tail Cost?

DevFeed: [Lorenz and Little: How Much Does Your Tail Cost?](<https://devfeed.tech/articles/lorenz-and-little-how-much-does-your-tail-cost-12600.md>)

Original publisher: [Read original article](<http://brooker.co.za/blog/2026/07/29/lorenz-and-little.html>)

Author: Marc Brooker

Published: 2026-07-29T00:00:00Z

Content type: article

Language: en

Sources: [Marc Brooker's Blog](<https://devfeed.tech/sources/marc-brooker-s-blog.md>), [Marc Brooker's Blog](<https://devfeed.tech/sources/marc-brooker-s-blog-2.md>)

Topics: [Latency](<https://devfeed.tech/topics/latency.md>), [Statistics](<https://devfeed.tech/topics/statistics.md>), [Optimization](<https://devfeed.tech/topics/optimization.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>)

Tags: [2026](<https://devfeed.tech/tags/2026.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [cost](<https://devfeed.tech/tags/cost.md>), [latency](<https://devfeed.tech/tags/latency.md>), [optimization](<https://devfeed.tech/tags/optimization.md>), [statistics](<https://devfeed.tech/tags/statistics.md>)

## AI overview

The article explains how tail-latency percentiles contribute to mean latency, concurrency, and service cost. It introduces the empirical Lorenz Curve and uses Little's law to argue that optimizing the tail can substantially reduce concurrency, capacity demand, and lock contention.

## Source excerpt

Lorenz and Little: How Much Does Your Tail Cost? Lorenz and Little sounds like hipster burger bar from 2015. It's time for Marc's Amateur Statistics Corner! Today: why I pay a lot of attention to tail latency when optimizing cost. I've written before on the importance of tail latency for customer experience (e.g. in 2026, 2021, and 2021, and 2017). Today, I want to talk about tail latency from the perspective of cost and capacity. Like many system operators, I think about tail latency using percentiles. Here's a question: how much does each of my latency percentiles contributed to the mean latency? Intuitively, the answer is "quite a lot", but can we quantify that? We can! The thing we're looking for is the empirical Lorenz Curve. It directly calculates the answer to the question: given a latency percentile $P$ (e.g. p99=100ms), how much do requests taking shorter than $P$ contribute to the mean latency? (Let's call it $L(P)$ , so the real answer to our question is $1 - L(P)$). Starting from latency samples, the calculation is pretty simple: L = sum(sorted(x)[:k]) / sum(x) (for a set of n latency samples x, and k=p*n). From a vector of quantiles, things get a little more complicated, because we have to choose how to interpolate between the samples and extrapolate out to the maximum. Here I'm interpolating using a power law, which is a little bit of a sin1, but good enough for our purposes. # Calculate 1 - L(p) for a vector of measured quantiles # q - an array of quantiles (e.g. [1, 10, 200, 10000, 20000]) # p - an array of percentiles they're measured at (e.g. [0, 0.5, 0.9, 0.99, 0.999]) # OneMinusL - One minus the empirical Lorenz curve for each of the percentiles def OneMinusL(q, p): ...Show full implementationHide implementation # Calculate 1 - L(p) for a vector of measured quantiles # q - an array of quantiles (e.g. [1, 10, 200, 10000, 20000]) # p - an array of percentiles they're measured at (e.g. [0, 0.5, 0.9, 0.99, 0.999]) # OneMinusL - One minus the empirica