Prometheus vs VictoriaMetrics: a measured comparison on identical small EC2 hosts
Why I did this
At work I am building a VictoriaMetrics cluster as a long-term metric store. I have run Prometheus for years, but VictoriaMetrics was new to me, and most of what I could read about it was written by the vendor. I wanted my own numbers before trusting anyone else’s.
So I built the smallest fair test I could: one Prometheus, one VictoriaMetrics single-node, same instance type, same scrape config, same retention, same synthetic load, and measured what actually differs. Memory, disk, query speed, query language, behaviour under churn, restart, backup. Nothing here comes from work; every number is from this lab and every query that produced it is in the text, so anyone can repeat it.
The lab runs on plain VMs with systemd units, not containers, because that is how the production cluster will run, and because it keeps the comparison about the databases rather than about an orchestrator.
The setup
Three Ubuntu 24.04 hosts in ap-southeast-2, built with Terraform (repo):
| Host | Type | Runs |
|---|---|---|
| prom | t3.small (2 vCPU, 2 GiB) | Prometheus v3.15.1, node_exporter |
| vm | t3.small (2 vCPU, 2 GiB) | VictoriaMetrics v1.155.0 single-node, node_exporter |
| loadgen | t3.micro | avalanche v0.7.0, Grafana 13.3.0, node_exporter |
Both databases scrape the same four jobs from the same file every 15 s, with 7-day retention. Load is avalanche: 500 gauges × 50 series + 50 counters ≈ 27,500 active series, label set rotated every 3600 s.
| job | Targets | What it gives |
|---|---|---|
node |
all three hosts, port 9100 | host CPU, memory, disk via node_exporter |
avalanche |
loadgen, port 9001 | synthetic load, 27,500 series |
prometheus |
prom, port 9090 | Prometheus internal metrics |
victoriametrics |
vm, port 8428 | VictoriaMetrics internal metrics |


1. RAM, CPU and disk, at 1 hour and at 24 hours
Setup. Both read from Grafana, both datasources, same 15-minute window. First reading 70 minutes after boot
(21:56 SGT, 5 Nov, 11 minutes after the first avalanche label rotation). Second reading 24 hours after boot
(20:45 SGT, 6 Nov, uptime 86,765 s). Disk at 24 h is du -sb over ssh; the databases’ own size metrics agreed within 6 %
(Prometheus prometheus_tsdb_storage_blocks_bytes + prometheus_tsdb_wal_storage_size_bytes = 540 MiB, VM sum(vm_data_size_bytes) = 455 MiB).
Result.
| Metric | Prometheus 1 h | VM 1 h | Ratio 1 h | Prometheus 24 h | VM 24 h | Ratio 24 h |
|---|---|---|---|---|---|---|
| RSS (MiB) | 265 | 118 | 2.2x | 341 | 133 | 2.6x |
| CPU (cores, 15 min avg) | 0.010 | 0.022 | 0.45x | 0.011 | 0.021 | 0.50x |
| Samples/s ingested | 2,122 | 2,128 | 1.0x | 2,109 | 2,110 | 1.0x |
| Active series, steady state | 31,368 | 31,497 | 1.0x | n/a (head_series counts churned series too) | 31,597 | |
| Series held in memory after churn | 59,069 | 58,997 | 1.0x | 114,150 (head, up to 3 h of rotations) | 59,119 (hour_metric_ids) | 1.9x |
Data dir, du -sb (MiB) |
61 (57 WAL + 5 chunks_head, no block yet) | 21 | 2.9x | 572 (5 blocks 284 + WAL 256 + chunks_head 32) | 455 (small parts 294 + big parts 113 + index) | 1.26x |
| Samples ingested total (M) | 9.66 | 9.63 | 1.0x | 183.4 | 183.4 | 1.0x |
| Bytes per sample | 6.6 | 2.3 | 2.9x | 3.27 | 2.60 | 1.26x |
Ratio = Prometheus / VictoriaMetrics. Bytes per sample = data dir bytes / samples ingested total at the same time.
What I learned.
- RAM: VM uses 2.6x less. 133 MiB vs 341 MiB. Clear win.
- Disk: VM uses 1.26x less. 455 MiB vs 572 MiB. Small win. The vendor quotes about 2.5x; this test did not reproduce it, because the test data is random numbers that compress badly in both.
- CPU: VM uses 2x more. 0.021 vs 0.011 cores. Both tiny. Not important at this load.
- Ingest: identical. 2,110 samples/s both, zero loss.
One line: VM saves memory for sure, saves disk a little, costs a little CPU. Disk saving depends on what metrics look like, not on engine alone.
2. Query latency
Setup. Same query, same range, 20 runs each, curl from the loadgen host so network cost is equal
(scripts/latency.sh in the repo). Step 15 s. VictoriaMetrics queried twice: with nocache=1 (cold)
and without (warm). Prometheus has no result cache, so one column. Data on disk at test time: about 24 h.
Result (p50 / p95, seconds).
| Query | Range | Prometheus | VM cold | VM warm |
|---|---|---|---|---|
light: sum by (job) (rate(node_cpu_seconds_total[5m])), 6 series |
6 h | 0.024 / 0.026 | 0.006 / 0.010 | 0.002 / 0.003 |
| light | 24 h | 0.086 / 0.086 | 0.015 / 0.017 | 0.004 / 0.004 |
heavy: sum by (series_id) ({__name__=~"avalanche_gauge_metric_mmmmm_0_[0-9]"}), 500 series |
6 h | 0.260 / 0.330 | 0.148 / 0.199 | 0.028 / 0.053 |
| heavy | 24 h | 2.379 / 2.469 | 1.408 / 1.476 | 0.075 / 0.084 |
topk: topk(10, sum by (series_id) (rate({__name__=~"avalanche_counter_metric_mmmmm_0_[0-9]_total"}[5m]))), 500 series |
6 h | 0.506 / 0.522 | 0.150 / 0.184 | 0.019 / 0.023 |
| topk | 24 h | 4.181 / 4.560 | 1.508 / 1.617 | 0.046 / 0.053 |
What I learned.
- Engine vs engine (Prometheus vs VM cold): VM 1.7x faster on plain sum, 2.8x on topk with rate(), 4 to 6x on tiny query. Real but not dramatic.
- rate() hurts Prometheus: heavy 2.4 s became topk 4.2 s. VM cold almost unchanged, 1.41 s to 1.51 s. VM’s rate implementation is cheaper.
- Cache is the big story: VM warm 20 to 90x faster than Prometheus on heavy queries. 46 ms vs 4.2 s. Dashboards refreshing every 30 s live in warm column.
- Both grow about linearly with range. 4x range cost ~9x time on both. Same scaling law, different constant.
3. PromQL vs MetricsQL: where the same query gives a different answer
Setup. Same expression sent to both /api/v1/query endpoints within milliseconds of each other
(scripts/promql-diff.sh). 15 s scrape interval on both. Avalanche counters grow by a random step every 30 s,
so they are bursty; node_exporter CPU counters are smooth. Run on 7 Nov 07:42 SGT, two minutes after an
avalanche label rotation (cycle_id 34 to 35), which is the worst case for both engines.
Result.
| Expression | Prometheus | VictoriaMetrics |
|---|---|---|
rate(avalanche_counter...{series_id="0"}[1m]), bursty counter |
0.822 | 1.500 |
rate(node_cpu_seconds_total{mode="idle",cpu="0"}[1m]), smooth counter |
0.962 | 0.972 |
increase(avalanche_counter...[1h]), old series |
5697.5 | 5708 |
increase(...), series born 2 min ago |
320.8 | 277 |
rate(node_cpu_seconds_total{...}), no window |
parse error: expected type range vector |
0.973 |
rate(x[5m]) default 0 |
parse error: unexpected identifier "default" |
0.825 |
label_set(up, "env", "lab") |
parse error: unknown function |
1 |
WITH (r = rate(x[5m])) r / 2 |
parse error: unexpected "=" |
0.4125 |
range_last(gauge[10m]) |
parse error: unknown function |
94 |
avalanche_gauge...{series_id="0"}, same instant |
35 | 60 |
count(avalanche_gauge_metric_mmmmm_0_0) |
50 | 50 |
What I learned. Where no maths is involved, both engines return the same answer: count() gave 50 on both,
up gave 1 on both. The gauge that showed 35 on one and 60 on the other is not an engine difference; two scrapers hit
avalanche at different moments of its 30-second value change, and any side-by-side test of two scrapers carries that noise.
rate() and increase() work differently by design. Prometheus extrapolates the samples in the window out to the
window edges, so it returns fractions and ignores the first sample of a new series. VictoriaMetrics uses the last sample
before the window, does not extrapolate, returns whole-number increases, and counts a new series as starting from zero.
On a smooth counter such as CPU seconds the two were 1 % apart. On the bursty avalanche counter they were 80 % apart.
The data shape decides the gap, not the engine. Alert thresholds tuned on one need checking on the other.
Everything MetricsQL adds (default, label_set, WITH, range_last, rate() without a window) is a parse error
on Prometheus. These are conveniences, not capabilities: each has a longer pure-PromQL equivalent or a recording rule.
I see no strong advantage in the query language either way. The practical rule is to keep dashboards and alert rules in
pure PromQL so they run on both, and to treat MetricsQL extensions as a one-way door.
4. Cardinality churn
Setup. Avalanche label rotation changed from every 3600 s to every 120 s, so about 27,500 series are replaced
every two minutes: roughly 195 new series per second, 800,000 per hour, on both databases. Snapshots taken with
scripts/churn.sh before the change (7 Nov 08:02 SGT, after 36 h of hourly rotation) and 100 minutes after it (09:46).
Then -storage.maxHourlySeries=100000 added to the VictoriaMetrics unit and the service restarted at 09:47.
Final snapshot 09:57. Prometheus was OOM-killed at 09:55, so its +100 min column is the last reading before death.
Result.
| Metric | Prometheus before | Prometheus +100 min | VM before | VM +100 min |
|---|---|---|---|---|
| New series per second | 0 (between rotations) | 193 | 0 | 197 |
| Series created in last hour | 27,764 | 800,837 | 27,629 | 779,344 |
| Series held in memory | 86,798 (head) | 1,379,298 (head) | 59,270 (hour cache) | 774,267 (hour cache) |
| Active series | n/a | n/a | 31,745 | 503,472 |
| RSS (MiB) | 443 | 1,529 | 236 | 362 |
| Host memory available (MiB) | 38 | 1,139 | ||
| CPU (cores) | 0.011 | 0.026 | 0.019 | 0.042 |
| Samples/s ingested | 2,118 | 2,312 | 2,119 | 2,406 |
| Slow row inserts/s | n/a | n/a | 0 | 197 (8 % of inserts) |
| Restarts / OOM kills | 0 | 0 at 100 min; 6 OOM kills in 3 min from 110 min | 0 | 0 |
With -storage.maxHourlySeries=100000, +10 min |
n/a | n/a | 100,000 series held, 1,607 rows/s dropped, 46 new series/s accepted, RSS 164 MiB, ingest 2,360/s |
Prometheus head_series counts every series seen since the last head truncation, which happens every two hours.
VictoriaMetrics storage/hour_metric_ids counts series seen in the current hour; storage/tsid is the series with
recent samples. Different windows, same role: what the engine has to hold in RAM.
What I learned.
- Same churn, 4.2x RAM gap at 100 min and widening. Prometheus went from 443 to 1,529 MiB and the host had 38 MiB left; VictoriaMetrics went from 236 to 362 MiB. Prometheus keeps every churned series in the head until the next 2-hour block cut. VictoriaMetrics writes the index to disk and ages series out of its caches.
- Neither dropped samples. Ingest held at ~2,100 to 2,400 samples/s on both while series count went up 25x.
- CPU roughly doubled on both and stayed below 5 % of one core. Churn is a memory problem first.
- VictoriaMetrics shows churn as a counter you can alert on: slow inserts at 8 % of all inserts, above the vendor’s
5 % rule of thumb. Prometheus shows it only as RSS growth and
prometheus_tsdb_head_series_created_total. - VictoriaMetrics has a storage-level limiter. Prometheus has none; its tools are
sample_limit(drops the whole scrape) and relabeling (needs you to know the bad label in advance). - Prometheus did not reach its 2-hour head truncation. At 110 minutes the kernel killed it at 1.65 GB. systemd restarted it, WAL replay rebuilt the same 1.5 M series in 16 s, and it was killed again 10 s later: six times in three minutes. It cannot recover alone, because replaying the WAL recreates the memory that killed it. The ways out are a bigger host or deleting the WAL and losing everything since the last block.
- The VictoriaMetrics limiter did what the docs say. Ten minutes after the restart with
-storage.maxHourlySeries=100000: exactly 100,000 series held, 1,607 samples/s refused, ingest of everything else unaffected, RSS back to 164 MiB. The refused samples are silent on the scrape side: the avalanche target still shows as healthy, so alert onvm_hourly_series_limit_rows_dropped_total. One caveat: the restart itself emptied the caches, so 362 to 164 MiB is restart plus limiter, not the limiter alone.
5. Restart and crash recovery
Setup. Fresh hosts, 25 minutes of data, about 31,500 series. On each host, scripts/restart-test.sh:
three systemctl restart, then three kill -9 of the main process (systemd restarts it). Time measured from the
command to /-/ready (Prometheus) or /health (VictoriaMetrics) returning 200. After each kill, the script counts
how many of the four expected samples of one 15-second series survived in the minute before the kill. Run 7 Nov 18:10 SGT.
Result.
| Case | Prometheus | VictoriaMetrics |
|---|---|---|
| Clean restart, 3 runs (s) | 1.10, 1.10, 1.10 | 0.22, 0.22, 0.22 |
kill -9 to ready, 3 runs (s) |
2.21, 1.30, 1.58 | 0.22, 0.64, 0.43 |
| Samples kept in the minute before each kill | 4 of 4, 4 of 4, 4 of 4 | 4 of 4, 4 of 4, 4 of 4 |
| What startup does | Replays WAL (6 segments here) into the head | Loads caches from disk, opens parts |
| Same test with 1.5 M series in the head (churn night) | 16 s replay, then OOM before serving | not tested |
What I learned.
- Both come back in about a second. VM 0.2 s, Prometheus 1.1 s.
kill -9lost nothing on either. VM can lose up to 5 s of samples in theory; three kills did not hit that window.- Prometheus startup grows with series count because it replays the WAL: 0.1 s at 31k series, 16 s at 1.5 M. VM startup does not change with size.
6. Snapshot and backup
Setup. Retention is set to 7 days on both but a lab that is destroyed nightly never reaches it, so this section is
backup only. Same six steps on both hosts, timed over ssh (scripts/backup-test.sh): snapshot, upload to one S3
bucket, snapshot and upload again two minutes later, stop the service, wipe the data directory, restore from S3,
start, and compare count_over_time(up{job="avalanche"}[2h]) before and after. Both hosts reach the bucket through an
EC2 instance profile, no keys. Prometheus has no backup tool, so its upload is aws s3 sync of the snapshot
directory; VictoriaMetrics uses vmbackup and vmrestore. Prometheus needs --web.enable-admin-api for the
snapshot endpoint; VictoriaMetrics has /snapshot/create on by default.
The run was split by accident: the laptop driving it slept between the first Prometheus upload (18:18 SGT, 30 minutes of data) and the rest (22:10 to 22:14 SGT, 4.4 hours of data). Times are from the host, so the split does not change them, but the first Prometheus snapshot is of a smaller database than everything else.
Result.
| Step | Prometheus | VictoriaMetrics |
|---|---|---|
| Snapshot command | POST /api/v1/admin/tsdb/snapshot |
GET /snapshot/create |
| Snapshot time (s, incl. ssh) | 1.8 | 1.9 |
| Snapshot cost on disk | 9.4 MB new: the head is written out as a block (data dir was 24 MB, almost all WAL) | ~0: hard links to existing parts |
| First upload | aws s3 sync: 4 objects, 9.4 MB, 4.2 s |
vmbackup: 68.8 MB in 0.79 s (3.0 s incl. ssh) |
| Second upload, 2 min later | second snapshot held 3 blocks, 68.4 MB; sync uploaded all of it, 8.3 s. Each snapshot writes a new head block with a new name, so the head part is never incremental | vmbackup: uploaded 2.0 MB, server-side deleted 0.8 MB, 0.21 s. Only parts that changed |
| Restore | stop, rm -rf, aws s3 sync back, chown, start: 6.2 s to ready |
stop, rm -rf, vmrestore (66.8 MiB in 1.0 s), chown, start: 3.6 s to ready |
| Samples in 2 h window, after restore | 479 of 480 (one scrape lost during the stop) | 480 of 480 |
| Data dir after restore | 72.3 MB (restored blocks + new WAL) | 70.3 MB |
| S3 after both runs | 68.4 MB | 70.0 MB |
| Scheduling, retention of backups | your cron, your aws s3 lifecycle rules |
vmbackupmanager: Enterprise. OSS is your cron too |
What I learned.
- Snapshot and restore take seconds on both. Speed is not the difference.
- Tooling is. VM has
vmbackup(incremental) andvmrestore(one command). Prometheus gives a snapshot directory; shipping and restoring it is your script. - Neither schedules backups in open source. VM’s scheduler is Enterprise. Cron is yours either way.
Verdict
For a long-term store, VictoriaMetrics. Not because of disk, which was a small win here, but because of memory and churn: the same label rotation that killed Prometheus on a 2 GiB host left VictoriaMetrics at 362 MiB, and the limiter gave me a knob Prometheus does not have. Queries were faster cold and much faster warm, restart did not depend on data size, and backup was a tool rather than a script.
What it costs: rate() and increase() give different numbers by design, MetricsQL extensions are a one-way door, and
the features that make the long-term story complete (downsampling, backup scheduling, per-tenant stats) are paid.
I would keep Prometheus as the scraper and alert evaluator where it already runs, write every rule in pure PromQL, and send to VictoriaMetrics for storage. For a small team with one Prometheus and 15 days of retention, nothing here says switch.
What I would do next
- Cluster mode: vminsert, vmselect, three vmstorage, RF=2. Take one node out and measure the reroute churn.
remote_writefrom Prometheus into VictoriaMetrics instead of double scraping, so both hold identical samples.- Real metric shapes instead of random gauges, to see whether the 2.5x disk claim holds.