Time-series databases — Prometheus + VictoriaMetrics architecture with high-cardinality scrape ingestion, PromQL range query, downsampling pipeline (1m -> 5m -> 1h -> 1d) with retention drops, and ADR comparing Prometheus / InfluxDB / TimescaleDB / ClickHouse / Mimir for a Kubernetes platform with 3M active series.
TSDB — это не «обычная БД плюс timestamp». Series identity определяет index cardinality, event time определяет placement, а retention/compaction меняют физические blocks. Корректный дизайн отдельно задаёт durability ingest, обработку late/out-of-order samples и query resolution.
| Компонент | Ответственность |
|---|---|
| Metric Producers | Отправляют timestamped samples и стабильный набор dimensions. |
| Ingest Gateway | Проверяет schema, timestamp bounds, tenant limits и idempotency identity. |
| WAL and Mutable Head | Защищает незакомпакченные samples от process crash в пределах настроенной durability. |
| Series and Label Index | Находит series по dimensions; его стоимость растёт с cardinality. |
| Immutable Time Blocks | Хранит compressed chunks, metadata и tombstones по time range. |
| Compactor and Retention | Создаёт larger blocks, удаляет fully expired blocks и учитывает temporary disk headroom. |
| Range Query Engine | Планирует range scan, downsampling и aggregation без обещания fixed latency. |
Valid samples enter the WAL/head before acknowledgement and later become immutable blocks; that ordering is an engine-specific durability contract, not a claim that every TSDB replicates.
Проверяемый исход: Success is acknowledged only at the configured durable boundary; compaction is asynchronous.
A retry or delayed producer can target an older time range. The gateway applies the documented engine policy: reject, overwrite by identity, or accept into a correction path.
Проверяемый исход: No silent double count: duplicate identity and lateness policy are observable and deterministic.
Compaction temporarily keeps inputs and outputs. Retention removes fully expired blocks in background rather than promising an exact byte ceiling at every instant.
Проверяемый исход: Disk alerting includes WAL/head and compaction overlap; deletion is not treated as an immediate space guarantee.
Unbounded user-controlled labels create new series and pressure the index and memory even when samples per second look acceptable.
Проверяемый исход: Tenant limits reject or quarantine dangerous dimensions before the index becomes the global bottleneck.
Числа выше — учебные inputs или размерностные формулы. Их нельзя выдавать за benchmark или SLA конкретного продукта.
Диаграмма показывает причинные границы и recovery contracts, а не скрытую реализацию конкретного managed-сервиса. Любая stronger guarantee действует только в явно названной transaction/checkpoint/acknowledgement boundary.
Введите числа или выберите пресет