Skip to main content

VictoriaMetrics

A high-performance open-source time series database fully compatible with Prometheus. VictoriaMetrics stores metrics data with 10-30x better compression than Prometheus TSDB, supports ingestion via Prometheus remote_write, queries via MetricsQL (a PromQL superset), and scales from a single node to a distributed cluster.

✓ Prometheus remote_write compatible ✓ 10-30x better compression ✓ MetricsQL (PromQL superset) ✓ Cluster mode for scale

What is VictoriaMetrics?

VictoriaMetrics is a time-series database designed to replace Prometheus's built-in TSDB as a long-term metrics store. It accepts data via Prometheus remote_write, Graphite, InfluxDB, and OpenTelemetry — and queries are made using MetricsQL, a superset of PromQL that adds useful functions missing from the Prometheus query language.

The key advantage over plain Prometheus storage is efficiency: VictoriaMetrics uses a custom compression algorithm (up to 30x better than Prometheus TSDB) and handles high cardinality gracefully — where Prometheus can struggle with tens of millions of unique label combinations, VictoriaMetrics handles hundreds of millions. This makes it ideal for Kubernetes multi-tenant environments with dynamic pod IPs and labels.

Quick Start (Single-Node Docker)

# Single-node VictoriaMetrics
docker run -d --name vm   -p 8428:8428   -v /path/to/data:/victoria-metrics-data   victoriametrics/victoria-metrics:latest   -retentionPeriod=12   # 12 months retention

# Access:
# - HTTP API:          http://localhost:8428
# - Prometheus UI:     http://localhost:8428/vmui
# - Write endpoint:    http://localhost:8428/api/v1/write  (Prometheus remote write)
# - MetricsQL query:   http://localhost:8428/api/v1/query

Prometheus remote_write Integration

# prometheus.yml — remote_write to VictoriaMetrics
global:
  scrape_interval: 15s

remote_write:
  - url: http://victoria-metrics:8428/api/v1/write
    queue_config:
      max_samples_per_send: 10000
      max_shards: 30

# Or replace Prometheus entirely with vmagent (lighter scraper)
# vmagent.yaml
scrapeConfigs:
  - job_name: node-exporter
    static_configs:
      - targets: ['node-exporter:9100']
remoteWrite:
  - url: http://victoria-metrics:8428/api/v1/write

MetricsQL Examples

# MetricsQL — compatible with PromQL, plus extensions

# Standard PromQL (works in VictoriaMetrics)
rate(http_requests_total[5m])
histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m]))

# MetricsQL extensions
# Default rollup (auto-selects rate/avg/last based on metric type)
http_requests_total

# median_over_time (missing in PromQL)
median_over_time(response_time_ms[1h])

# share_gt_over_time — what % of time value was above threshold
share_gt_over_time(cpu_usage[24h], 0.8)

# Running average with outlier removal
smooth(rate(http_requests_total[5m]), 0.05)

# Aggregate by multiple labels with label_values
sort_by_label(sum by (service, env) (rate(errors_total[5m])), "service")

Cluster Deployment (Docker Compose)

# docker-compose — VictoriaMetrics cluster
services:
  vmstorage:
    image: victoriametrics/vmstorage:latest
    ports: ["8482:8482", "8400:8400", "8401:8401"]
    volumes: ["vmstorage-data:/storage"]
    command: -storageDataPath=/storage -retentionPeriod=6

  vminsert:
    image: victoriametrics/vminsert:latest
    ports: ["8480:8480"]
    command: -storageNode=vmstorage:8400

  vmselect:
    image: victoriametrics/vmselect:latest
    ports: ["8481:8481"]
    command: -storageNode=vmstorage:8401

  vmagent:
    image: victoriametrics/vmagent:latest
    volumes: ["./vmagent.yaml:/etc/vmagent.yaml"]
    command: -promscrape.config=/etc/vmagent.yaml
             -remoteWrite.url=http://vminsert:8480/insert/0/prometheus/api/v1/write
Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →