# Histogram vs eCDF

DevFeed: [Histogram vs eCDF](<https://devfeed.tech/articles/histogram-vs-ecdf-12524.md>)

Original publisher: [Read original article](<http://brooker.co.za/blog/2022/09/02/ecdf.html>)

Author: Marc Brooker

Published: 2022-09-02T00: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: [Statistics](<https://devfeed.tech/topics/statistics.md>), [Latency](<https://devfeed.tech/topics/latency.md>), [Caching](<https://devfeed.tech/topics/caching.md>), [Low Latency](<https://devfeed.tech/topics/low-latency.md>), [systems](<https://devfeed.tech/topics/systems.md>), [data](<https://devfeed.tech/topics/data.md>), [Databases](<https://devfeed.tech/topics/databases.md>)

Tags: [cache](<https://devfeed.tech/tags/cache.md>), [data](<https://devfeed.tech/tags/data.md>), [databases](<https://devfeed.tech/tags/databases.md>), [latency](<https://devfeed.tech/tags/latency.md>), [low-latency](<https://devfeed.tech/tags/low-latency.md>), [measurements](<https://devfeed.tech/tags/measurements.md>), [statistics](<https://devfeed.tech/tags/statistics.md>), [systems](<https://devfeed.tech/tags/systems.md>)

## AI overview

The article compares histograms with empirical cumulative distribution functions (eCDFs) for presenting latency and other measured data. It argues that eCDFs make multimodal distributions, percentile values, cache hit rates, and tail behavior easier to interpret and inspect.

## Source excerpt

Histogram vs eCDF Accumulation is a fun word. Histograms are a rightfully popular way to present data like latency, throughput, object size, and so on. Histograms avoid some of the difficulties of picking a summary statistic, or group of statistics, which is hard to do right. I think, though, that there's nearly always a better choice than histograms: the empirical cumulative distribution function (eCDF). To understand why, let's look at an example, starting with the histogram1. This latency distribution is very strongly bimodal. It's the kind of thing you might expect from a two-tiered cache: a local tier with very low latency, and a remote tier with latency in the 2 to 3ms range. Super common in systems and databases. The histogram illustrates that bimodality very well. It's easy to see that the second mode is somewhere around 2.5ms. The next two questions on my mind would be: how much do these two spikes contribute? and where is the first spike? In histogram form, its hard to answer these questions. The first we'd need to answer by doing some mental area-under-the-curve estimation, and the second is obscured by bucketing. Here's the same data in eCDF form. You can think of it as the histogram summed up, or integrated, or accumulated2. The first thing you may notice is how easy it has become to see the relative contribution of our first and second mode. The first mode contributes around 70% of measurements. If this is a cache system, we immediately know that our cache hit rate is around 70%. We also know that the 65th percentile is very low, and the 75th is very high. In fact, we can read these percentile3 values right off the graph by finding the 0.65 and 0.75 points on the Y axis, moving right until we hit the curve, and reading their value off the X axis. Magic! The second question, about the location of the first spike, can be answered by zooming in. That works because the eCDF, unlike the histogram, doesn't require bucketing, so we can zoom around in X and Y