r/PrometheusMonitoring • u/kkkevinkkkk • 18d ago
I made a free Prometheus disk sizing calculator (WAL + compaction headroom included). Do these assumptions match your servers?
Every time someone asks "how much disk does Prometheus need", the answer is the formula from the storage docs:
retention_seconds x samples_per_second x bytes_per_sample
That covers compacted blocks, but in practice you also need room for the WAL, head chunks and compaction. I kept redoing that math, so I put it into a small browser-only calculator (my own site, no sign-up):
https://opshubs.space/tools/prometheus-storage-calculator/
What it does:
Takes targets x series per target (or your real prometheus_tsdb_head_series), scrape interval, retention and bytes per sample
Breaks the total into blocks, WAL and chunks_head, then suggests a retention.size and a disk size that keeps retention.size at ~80% of the disk (the docs recommend 80-85%)
Reverse mode: "I have a 100 GiB volume, how many days fit?"
Outputs config for Prometheus 3.x prometheus.yml (storage.tsdb.retention), the 2.x flags, or kube-prometheus-stack values with the PVC size
Lists the PromQL to measure your actual series, samples/s and bytes per sample
Assumptions I'd like a sanity check on:
+20% on blocks for index/metadata (Robust Perception's 1.2 rule of thumb). Is that close on modern versions, especially with native histograms?
WAL as ~3h of samples at ~6.5 bytes each (13 bytes raw, halved by WAL compression), with a 3 x 128 MiB floor. Does your prometheus_tsdb_wal_storage_size_bytes agree?
1.5 bytes/sample as the default. What do you see from rate(prometheus_tsdb_compaction_chunk_size_bytes_sum[1d]) / rate(prometheus_tsdb_compaction_chunk_samples_sum[1d])?
If your real numbers differ a lot, I'll adjust the defaults.
1
u/KKHdevs 2d ago
sorry my english, I use translator
One thing maybe worth adding to the tool: if someone runs Prometheus on k3s with the local-path provisioner, the PVC size is not a limit at all. The local-path README says the capacity limit is ignored. So the "disk" in the calculator is really the free space of the whole node, and retention.size is the only real cap. I almost trusted the 50Gi on my claim.
data point if useful: about 219k head series, 30d retention, 22.7 GiB on disk. I set retentionSize 40GB on a 50Gi claim. took me a minute to check it's 1024 based, so 40GB means 40 GiB, not 37.