How ClickHouse Inspired Us to Build a High Performance Time Series Database
About me
What is VictoriaMetrics?
The history of VictoriaMetrics
The history of VictoriaMetrics: ad analytics and PostgreSQL
PostgreSQL
Ad click events
Ad view events
Analytical reports
The history of VictoriaMetrics: ad analytics and PostgreSQL
PostgreSQL
Ad click events
Ad view events
Analytical reports
I’m slow :(
100K events/sec
The history of VictoriaMetrics: ad analytics and PostgreSQL
The history of VictoriaMetrics: ad analytics and PostgreSQL
The history of VictoriaMetrics: ad analytics and PostgreSQL
The history of VictoriaMetrics: ad analytics and PostgreSQL
ClickHouse for ad analytics
The history of VictoriaMetrics: ad analytics and ClickHouse
The history of VictoriaMetrics: ad analytics and ClickHouse
The history of VictoriaMetrics: ad analytics and ClickHouse
The history of VictoriaMetrics: ad analytics and ClickHouse
The history of VictoriaMetrics: ad analytics and ClickHouse
The history of VictoriaMetrics: ad analytics and ClickHouse
The history of VictoriaMetrics: Prometheus and ClickHouse
ClickHouse as data storage for Prometheus
The history of VictoriaMetrics: ClickHouse as metrics storage
http_requests_total{path=”/foo”,job=”webserver”,instance=”host-1:80”} 12 34567
The history of VictoriaMetrics: ClickHouse as metrics storage
http_requests_total{path=”/foo”,job=”webserver”,instance=”host-1:80”} 12 34567
metric_name
labels
value
timestamp
The history of VictoriaMetrics: ClickHouse as metrics storage
samples (
metric_name String,
labels String,
timestamp Int64,
value Float64
) ORDER BY (metric_name, labels, timestamp)
The history of VictoriaMetrics: ClickHouse as metrics storage
samples (
metric_name String,
labels String,
timestamp Int64,
value Float64
) ORDER BY (metric_name, labels, timestamp)
The history of VictoriaMetrics: ClickHouse as metrics storage
metric_to_series (metric_name String, labels String, series_id Uint64) ORDER BY (metric_name, labels)
The history of VictoriaMetrics: ClickHouse as metrics storage
metric_to_series (metric_name String, labels String, series_id Uint64) ORDER BY (metric_name, labels)
samples (series_id Uint64, timestamp Int64, value Float64) ORDER BY (series_id, timestamp)
The history of VictoriaMetrics: ClickHouse as metrics storage
metric_to_series (metric_name String, labels String, series_id Uint64) ORDER BY (metric_name, labels)
samples (series_id Uint64, timestamp Int64, value Float64) ORDER BY (series_id, timestamp)
The history of VictoriaMetrics: ClickHouse as metrics storage
label_to_series (label_name_value String, series_id Uint64) ORDER BY (label_name_value, series_id)
The history of VictoriaMetrics: ClickHouse as metrics storage
samples (timestamp Int64 Codec(DoubleDelta), value Float64 Codec(Gorilla))
The history of VictoriaMetrics: ClickHouse as metrics storage
samples (timestamp Int64 Codec(DoubleDelta), value Float64 Codec(Gorilla))
The history of VictoriaMetrics: ClickHouse as metrics storage
series (metric_name LowCardinality(String), labels String, series_id Uint64)
label_to_series (label_name_value LowCardinality(String), series_id Uint64)
The history of VictoriaMetrics: ClickHouse as metrics storage
series (metric_name LowCardinality(String), labels String, series_id Uint64)
label_to_series (label_name_value LowCardinality(String), series_id Uint64)
The history of VictoriaMetrics: ClickHouse as metrics storage
The history of VictoriaMetrics: ClickHouse as metrics storage
metric_to_series (metric_name_with_labels String, series_id Uint64) ORDER BY (metric_name_with_labels, labels)
This table is used by the app, which accepts new samples and needs to determine the corresponding series_id per each incoming sample
The history of VictoriaMetrics: ClickHouse as metrics storage
metric_to_series (metric_name_with_labels String, series_id Uint64) ORDER BY (metric_name_with_labels, labels)
series_to_metric (series_id Uint64, metric_name_with_labels String) ORDER BY (series_id)
This table is needed for converting the found series_id to human-readable format metric_name{labels} during queries
The history of VictoriaMetrics: ClickHouse as metrics storage
metric_to_series (metric_name_with_labels String, series_id Uint64) ORDER BY (metric_name_with_labels, labels)
series_to_metric (series_id Uint64, metric_name_with_labels String) ORDER BY (series_id)
label_to_series (label_name_value LowCardinality(String), series_id Uint64) ORDER BY (label_name_value, series_id)
This table is used for fast lookups of series_id for the given label filters during queries. For example, http_requests_total{job=”webserver”} should find series_id values for series with both {__name__=”http_requests_total”} and {job=”webserver”} labels
The history of VictoriaMetrics: ClickHouse as metrics storage
metric_to_series (metric_name_with_labels String, series_id Uint64) ORDER BY (metric_name_with_labels, labels)
series_to_metric (series_id Uint64, metric_name_with_labels String) ORDER BY (series_id)
label_to_series (label_name_value LowCardinality(String), series_id Uint64) ORDER BY (label_name_value, series_id)
samples (series_id Uint64, timestamp Int64 Codec(DoubleDelta), value Float64 Codec(Gorilla)) ORDER BY (series_id, timestamp)
This table stores (timestamp, value) pairs for the ingested samples
The history of VictoriaMetrics: ClickHouse as metrics storage
Meet VictoriaMetrics!
Meet VictoriaMetrics!
Meet VictoriaMetrics!
Meet VictoriaMetrics!
VictoriaMetrics: persistent data structures
VictoriaMetrics: data ingestion path
VictoriaMetrics: `samples` table internals
VictoriaMetrics: query path
VictoriaMetrics: query path
VictoriaMetrics: query path
VictoriaMetrics: query path
VictoriaMetrics: horizontal scalability
VictoriaMetrics: the end result
Thank you!