Skip to content

Prometheus Retention & Disk Calculator

Pure frontend: enter your scale parameters and get sample and disk estimates. This page does not read your Prometheus and makes no network requests.

How to use it

Fill in active series, scrape interval and retention days, then click Estimate. The tool expands the official formula step by step: samples per second, total samples, disk for the compressed samples themselves, and a figure with WAL and compaction headroom included.

Unpacking the formula

The documentation gives needed_disk_space = retention_time_seconds × ingested_samples_per_second × bytes_per_sample. Samples per second is not a mystery: it is active series divided by scrape interval. At 100,000 series and a 15-second interval, that is about 6,667 samples per second; over 30 days it is 17.28 billion samples, around 27 GB at 1.7 bytes each.

That 27 GB is the compressed sample body, not total disk. The directory also holds an index, tombstones, WAL and chunks_head. WAL contains raw, uncompressed samples in 128 MB segments. The docs say at least three segments are retained, and busy servers keep more to cover at least two hours of raw data. The minimum disk requirement is therefore the peak of WAL plus head chunks, not the number the formula produced. If the disk cannot hold that peak, shortening retention will not save you.

Why compaction briefly exceeds the limit

Prometheus cuts the in-memory head into a block every two hours, then compacts small blocks into larger ones. A compacted block spans at most ten percent of the retention window or 31 days, whichever is smaller. During a merge both source blocks and the new block must be on disk; only afterwards does background cleanup remove the old ones, and that cleanup can take up to two hours. Disk usage therefore rises past retention.size temporarily. This is expected behavior, not a fault.

It is also why the official guidance caps retention.size at 80 to 85 percent of allocated disk. The remaining space is compaction's working area. If you set the limit equal to the disk, a merge fills the disk and that is a genuine incident. When time and size retention are both configured, whichever triggers first wins, so you may be deleting old data earlier than the time value suggests.

What to do with the estimate

This number is best for spotting obviously wrong configurations and comparing the order of magnitude of options. Relaxing the interval from 15 to 60 seconds cuts sample count to a quarter and the estimate shows the saving directly. Removing a label like user_id may drop series by an order of magnitude, far more than fiddling with retention.

But do not treat it as a capacity acceptance test. Real environments have label churn, pods created and destroyed constantly, and histogram buckets adding hidden cardinality; all of that inflates the index beyond the formula. Once you are live, calibrate with two metrics: rate(prometheus_tsdb_head_samples_appended_total[1h]) for actual ingestion and prometheus_tsdb_head_series for active series trends. Feed those back into the calculator and the result starts to resemble your server.

Bytes per sample deserves one more note: it is not a constant. Compression depends on how noisy the values are; smooth metrics compress better, jittery ones worse. Someone else's 1.7 tells you an order of magnitude, nothing more. Measure your own by dividing the two compaction counters above and use that figure for decisions. The accuracy of an estimation tool is bounded by what you know about its inputs.

One last constraint: local storage is neither clustered nor replicated. It is a single-node database, and a failed disk loses data. No capacity calculation replaces snapshots or remote write. Plan for durability in the same breath as capacity.

Read Prometheus TSDB operations for the WAL/Head/Block layout and five real failures. See Prometheus alerting configuration for turning ingestion anomalies into alerts. The formula and flags follow the official Prometheus storage documentation.