VictoriaMetrics started as "a compact long-term storage for Prometheus" and grew into a whole metrics platform. The main question it answers: what to do when Prometheus can't handle the volume, while a full six-component cluster feels like overkill.
Platform components
| Component | Role | Replaces |
|---|---|---|
| vmagent | metric collection: scrape, relabel, buffering, remote_write | Prometheus in the collector role |
| singlenode | storage + queries in a single binary | standalone Prometheus |
| vmalert | alerting rules and recording rules | Prometheus rules |
| vmcluster | vminsert / vmselect / vmstorage | Thanos/Cortex for large volumes |
A typical replacement looks like this: exporters stay, the Prometheus scrape config moves into vmagent (same syntax), and the storage becomes single-node VM or a cluster — Alertmanager keeps handling alerts as before.
Why it fits where Prometheus cracks
- Compactness and speed. On the same series it takes noticeably less disk and answers "wide" queries faster than the default TSDB. Two years of retention fit where stock Prometheus started suffocating.
- vmagent is a collector that doesn't fear network trouble: disk buffering during outages,
remote_writeto any number of storages, and discovery cardinality doesn't eat its memory arenas. - One binary covers workloads that used to require a six-component cluster; when data grows really big —
vmstoragescales horizontally by adding nodes and replication. - Retention is one flag:
-retentionPeriod=2y— years of metrics without separate downsampling pipelines.
A minimal working vmagent config
- promscrape.config.files=/etc/vmagent/scrape.yml # same syntax as Prometheus
- remoteWrite.url=http://vminsert:8480/insert/0/prometheus/api/v1/write
- remoteWrite.label=path=infra,label=env=prod # external labels, like external_labels
- remoteWrite.tmpDataPath=/var/lib/vmagent/buffer # buffer for network outages
- remoteWrite.maxDiskUsagePerURL=2GB
The familiar syntax is half the migration's success: target lists, service discovery and relabel rules move over almost unchanged.
Compatibility
- PromQL (extended into MetricsQL): Grafana works with it as a Prometheus datasource, plus there's a native plugin with extended functions.
- Exporters and service discovery are the same; migration usually comes down to switching
remote_write, not rewriting the pipeline. - Alertmanager stays; vmalert sends alerts there — rules are written in the same format as Prometheus rules, plus built-in recording functions.
A health dashboard for VictoriaMetrics itself
vm_rows— ingest rate, where a flat line matters more than any sharp spike;vm_free_disk_space_bytes— disk via predict_linear: VM writes a lot, and planning the disk here matters no less than the stockpile;vm_rows_ignored_total/vm_rows_dropped_total— silently discarded metrics; growth signals limits or cardinality;vm_request_errors_total— vminsert/vmselect availability behind the load balancer.
An honest caveat
- For a small single-service bench, standalone Prometheus remains simpler — don't complicate things until there is pain.
- VictoriaMetrics is younger: for a rare case (complex org-wide federation, exotic service discovery) it's worth checking on a bench in advance.
- An honest test before the migration is to run your real dashboard queries on a bench with real volume: then the comparison uses your own numbers, not benchmarks from slide decks.
VictoriaMetrics is an answer to a specific pain: "lots of metrics, long retention, the disk budget is gone". If the pain hasn't arrived yet — don't treat it in advance; when it does — the solution is already proven.
vmcluster: when single-node stops being enough
The threshold is measured not abstractly but by two symptoms: ingestion lag and slow queries "across everything". The cluster components:
vmstorage: -storageDataPath=/storage -retentionPeriod=2y # data, scales by adding nodes
vminsert: -storageNode=vmstorage-1:8400,vmstorage-2:8400 # ingestion, stateless
vmselect: -storageNode=vmstorage-1:8400,vmstorage-2:8400 # queries, stateless
| Component | Stateless? | Scaling | What is lost on failure |
|---|---|---|---|
| vminsert | yes | by load balancer, horizontally | nothing — remote_write will retry |
| vmselect | yes | by load balancer, horizontally | queries — readers wait for replication |
| vmstorage | no (data) | adding nodes + replication -replicationFactor=2+ | queries continue from the replica |
Practice: replication with -replicationFactor=2 is the first cluster setting; then — -dedup.minScrapeInterval, so duplicates from dual vmagents don't double the data.
Downsampling and long retentions
Three years of raw metrics is expensive even for Victoria. The solution is layered:
- Hot (first 30 days): raw 30-second points.
- Roll-up (months and beyond): recording rules in vmalert (
avg_over_time/max_over_time) write aggregates into a separate tenant — a year-long graph stays instant. - Retention per layer: raw — 90 days, rollups — 3 years. The "what happened in March" query goes to the downsampled tenant and never touches hot data.
This is the same "retention in one flag", only with planning: without rollups, three years mean a linearly growing disk; with them — a flat one.