skillfed

hdrhistogram

High Dynamic Range histogram in native python

hdrhistogram v0.10.7 551.5K downloads/30d#6,048 on PyPI163
Permissive license Active released

What it is and what it does

hdrhistogram is a Python port of the Java HDR Histogram library, designed to record and analyze latency and performance distributions with high precision across a wide dynamic range. It solves the problem of accurately capturing percentile-based performance metrics without the memory overhead of storing every individual measurement; instead, it uses a bucketing strategy that trades a small, controlled amount of precision for dramatic space efficiency.

The package supports recording values with optional correction for coordinated omission (a common measurement bias in latency testing), querying percentiles and statistical summaries, iterating over recorded values in multiple ways, and serializing histograms to portable formats for storage or cross-platform analysis. It includes a command-line tool (dump_hdrh) for inspecting encoded histograms and supports 16-bit, 32-bit, and 64-bit counters. Runtime dependencies are minimal (pbr and setuptools for build support).

Use it for:

  • Track API response latencies in production and analyze tail percentiles (p99, p99.9) without storing every request.
  • Measure and compare performance distributions across multiple services or time windows by encoding histograms as portable blobs.
  • Correct for coordinated omission bias when benchmarking systems under load, ensuring accurate latency reporting.
  • Generate percentile distribution tables in .hgrm format for plotting and reporting performance characteristics.
  • Aggregate histograms from distributed systems into a central histogram for unified performance analysis.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Records and analyzes high-precision latency and performance distributions using HDR Histogram, a data structure optimized for capturing value ranges with controlled precision loss.

Yes. hdrhistogram is actively maintained, has no known vulnerabilities, and fills a specific need for efficient, precise latency distribution tracking. Install it if you need percentile-based performance analysis or are porting HDR Histogram code from Java or C. The prebuilt wheels make installation straightforward on common platforms; only consider friction if you're on an unsupported architecture.

Install

hdrhistogram on PyPI

pip

pip install hdrhistogram

uv

uv add hdrhistogram

poetry

poetry add hdrhistogram

Installing hdrhistogram

Before you install

Medium install friction due to C extension compilation fallback, though prebuilt wheels cover Linux, macOS, and Windows for Python 3.10–3.14. Active maintenance with recent release (66 days old) and no known vulnerabilities.

License in practice

Licensed under Apache Software License (permissive), allowing commercial and private use with minimal restrictions.

Quickstart

pip install hdrhistogram

from hdrhistogram import HdrHistogram

histogram = HdrHistogram(1, 3600000, 2)
histogram.record_value(latency)
percentile_99_9 = histogram.get_value_at_percentile(99.9)

Requires Python 3.10 or later; C compiler needed only if no prebuilt wheel matches your platform.

Verify before relying

  • Whether the package's coordinated omission correction is suitable for your specific measurement scenario.
  • Performance characteristics and memory overhead when recording millions of values.
  • Interoperability guarantees with Java and C HDR Histogram versions beyond V2 format.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies 2 — pbr, setuptools
Maintenance actively maintained — 66 days since the last release
Last repo commit
First released
Downloads 551,525/month — #6,048 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: hdrhistogram-0.10.7-cp310-cp310-macosx_11_0_arm64.whl; hdrhistogram-0.10.7-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; hdrhistogram-0.10.7-cp310-cp310-musllinux_1_2_x86_64.whl; hdrhistogram-0.10.7-cp310-cp310-win32.whl; hdrhistogram-0.10.7-cp310-cp310-win_amd64.whl; hdrhistogram-0.10.7-cp311-cp311-macosx_11_0_arm64.whl; hdrhistogram-0.10.7-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; hdrhistogram-0.10.7-cp311-cp311-musllinux_1_2_x86_64.whl; hdrhistogram-0.10.7-cp311-cp311-win32.whl; hdrhistogram-0.10.7-cp311-cp311-win_amd64.whl; hdrhistogram-0.10.7-cp312-cp312-macosx_11_0_arm64.whl; hdrhistogram-0.10.7-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; hdrhistogram-0.10.7-cp312-cp312-musllinux_1_2_x86_64.whl; hdrhistogram-0.10.7-cp312-cp312-win32.whl; hdrhistogram-0.10.7-cp312-cp312-win_amd64.whl; hdrhistogram-0.10.7-cp313-cp313-macosx_11_0_arm64.whl; hdrhistogram-0.10.7-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; hdrhistogram-0.10.7-cp313-cp313-musllinux_1_2_x86_64.whl; hdrhistogram-0.10.7-cp313-cp313-win32.whl; hdrhistogram-0.10.7-cp313-cp313-win_amd64.whl

Keywords: hdrhistogram, hdr, histogram, high, dynamic, range

Intended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: System AdministratorsLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOSOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

latency histogram recordinghigh dynamic range histogrampercentile analysisperformance distribution trackinghdr histogram pythoncoordinated omission correctionhistogram serialization
performance-monitoringlatency-analysismetrics

More Information Analysis packages