SlideShare a Scribd company logo
1 of 48
Download to read offline
Build Fast, Scalable
App Monitoring with
Open Source
Robert Hodges - Altinity
Roman Khavronenko - VictoriaMetrics
1
Letโ€™s make some introductions
2
Robert Hodges
Database geek with 30+ years
on DBMS systems. Day job:
CEO at Altinity
Roman Khavronenko
Distributed systems and
monitoring engineer. Day job:
SE at VictoriaMetrics
What is
application
monitoring?
3
Monitoring is for answering questions
โ— Why users are getting errors?
โ— When it started?
โ— How many users are affected?
โ— Which service is failing?
4
To get an answer to the question you need 3 things
1. The question
2. The information to process
3. The respondent
5
6
7
8
9
10
Using
VictoriaMetrics
11
VictoriaMetrics - Open Source Time Series Database & Monitoring Solution
โ— Vertically and horizontally scalable
โ— Operational simplicity
โ— Cost-ef๏ฌcient
โ— Prometheus compatible
โ— Free forever
12
VictoriaMetrics - Open Source Time Series Database & Monitoring Solution
โ— Kubernetes monitoring
โ— Hardware and infrastructure monitoring
โ— Application Performance Monitoring (APM)
โ— IoT
โ— Edge computing
โ— Alerting
13
14
Metric is a numeric measure or observation of something:
โ— Number of served requests
โ— Requests latency
โ— CPU or memory usage
โ— Occupied or free disk space
What is a metric?
15
Metrics structure
16
Storage for metrics
17
โ— VictoriaMetrics data model is schemaless
โ— No need to de๏ฌne metric names or their labels in advance
โ— User is free to add or change ingested metrics anytime.
Storage for metrics
18
OSA Con 2021: How ClickHouse Inspired Us
to Build a High Performance TSDB
โ— VictoriaMetrics is specialized solution for time series data
โ— Compression reaches 0.4 Bytes per sample
โ— Ingestions speed 300k samples/s per CPU core
โ— Scanning speed 50Mil samples/s per CPU core
19
> curl https://my.application/metrics
requests_total{path="/",code="200"}10
requests_total{path="/",code="240300"}1
20
> curl -d "requests_total{path="/",code="200"} 10" -X POST
http://victoriametrics/api/v1/import/prometheus
21
More than one protocol for metrics
โ— Prometheus remote write API.
โ— Prometheus text exposition format.
โ— DataDog protocol.
โ— In๏ฌ‚uxDB line protocol over HTTP, TCP and UDP.
โ— Graphite plaintext protocol with tags.
โ— OpenTSDB put message.
โ— HTTP OpenTSDB /api/put requests.
โ— JSON line format.
โ— Arbitrary CSV data.
22
Querying via MetricsQL
23
Querying via MetricsQL
24
Demo time!
โ— Run VictoriaMetrics
โ— Write some metrics
โ— Execute read queries
25
Frequently asked questions
โ— Can I monitor MySQL Server, Postgres, MongoDB, ClickHouse?
โ—‹ Yes, there are plenty of exporters, dashboards and alerting rules there.
โ— Can I monitor my applications?
โ—‹ Yes, there are libraries for multiple programming languages to instrument the application with
metrics.
โ— How expensive monitoring is?
โ—‹ With VictoriaMetrics, cost of storing metrics from 100 instances, each instance emits 1000
metrics every 30s for the total cost will be:
โ–  100GB of disk space $0.045 per GB-month: 100*0.045*12 = $54
โ–  One t3.medium instance, $0.0418 per hour: 0.0418*730*12 = $366
โ–  Total: $420 per year for monitoring 100 instances.
โ— Can I run it in Kubernetes?
โ—‹ Sure! We have k8s operator and helm charts for VictoriaMetrics!
26
Using
ClickHouse
27
ClickHouse: a real-time analytic database
It understands SQL
Itโ€™s Apache 2.0
It handles many use cases beyond monitoring
It also handles time series data very well
28
ClickHouse optimizes for fast response on large datasets
29
Highly compressed column
storage with indexing
Automatic replication
between nodes
SELECT host, avg(idle)
FROM vmstat GROUP BY host
Parallelized/vectorized
query
Table replica
ClickHouse can load millions of events per second
30
Unaggregated
event data
Source data table(s)
Parallel load
Event
Queue
(Kafka)
Custom
Application
Data Lake
(S3, HDFS)
Precomputed
aggregates
Precomputed
aggregates
Precomputed
aggregates
Materialized views
Instantly queryable
โ€ฆAnd supports [many] dozens of input formats
31
INSERT INTO some_table Format <format>
TabSeparated
TabSeparatedWithNames
CSV
CSVWithNames
CustomSeparated
Values
JSON
JSONEachRow
Protobuf
Parquet
...
There are many ways to store and manipulate time data
Date -- Precision to day
DateTime -- Precision to second
DateTime64 -- Precision to
nanosecond
toYear(), toMonth(), toWeek(),
toDayOfWeek, toDay(), toHour(), ...
toStartOfYear(), toStartOfQuarter(),
toStartOfMonth(), toStartOfHour(),
toStartOfMinute(), โ€ฆ, toStartOfInterval()
toYYYYMM()
toYYYYMMDD()
toYYYYMMDDhhmmsss()
And many more!
32
BI tools like Grafana like
DateTime values
Letโ€™s build a simple host monitoring system
33
$ vmstat 1 -n
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 166912 2645740 36792 3360652 0 0 3 101 1 1 2 1 98 0 0
1 0 166912 2645360 36792 3360652 0 0 0 0 1182 3986 7 1 93 0 0
ClickHouse
Grafana
Dashboard
Step 1: Generate vmstat data
34
#!/usr/bin/env python3
import datetime, json, socket, subprocess
host = socket.gethostname()
with subprocess.Popen(['vmstat', '-n', '1'], stdout=subprocess.PIPE) as proc:
proc.stdout.readline() # discard first line
header_names = proc.stdout.readline().decode().split()
values = proc.stdout.readline().decode()
while values != '' and proc.poll() is None:
dict = {}
dict['timestamp'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
dict['host'] = host
for (header, value) in zip(header_names, values.split()):
dict[header] = int(value)
print(json.dumps(dict), flush=True)
values = proc.stdout.readline().decode()
Hereโ€™s the output
35
{"timestamp": "2023-01-22 18:13:16", "host": "logos3", "r": 0, "b":
0, "swpd": 166912, "free": 2523688, "buff": 41412, "cache": 3408292,
"si": 0, "so": 0, "bi": 3, "bo": 101, "in": 1, "cs": 0, "us": 2,
"sy": 1, "id": 98, "wa": 0, "st": 0}
{"timestamp": "2023-01-22 18:13:17", "host": "logos3", "r": 0, "b":
0, "swpd": 166912, "free": 2523696, "buff": 41412, "cache": 3408316,
"si": 0, "so": 0, "bi": 0, "bo": 216, "in": 1214, "cs": 4320, "us":
1, "sy": 1, "id": 98, "wa": 0, "st": 0}
{"timestamp": "2023-01-22 18:13:18", "host": "logos3", "r": 0, "b":
0, "swpd": 166912, "free": 2527120, "buff": 41412, "cache": 3408572,
"si": 0, "so": 0, "bi": 0, "bo": 0, "in": 1172, "cs": 4162, "us": 2,
"sy": 1, "id": 98, "wa": 0, "st": 0}
Step 2: Design a ClickHouse table to hold data
36
CREATE TABLE monitoring.vmstat (
timestamp DateTime,
day UInt32 default toYYYYMMDD(timestamp),
host String,
r UInt64, b UInt64, -- procs
swpd UInt64, free UInt64, buff UInt64, cache UInt64, -- memory
si UInt64, so UInt64, -- swap
bi UInt64, bo UInt64, -- io
in UInt64, cs UInt64, -- system
us UInt64, sy UInt64, id UInt64, wa UInt64, st UInt64 -- cpu
) ENGINE=MergeTree
PARTITION BY day
ORDER BY (host, timestamp)
Dimensions
Measurements
Step 3: Load data into ClickHouse
37
INSERT INTO vmstat Format JSONEachRow
E.g.
INSERT='INSERT%20INTO%20vmstat%20Format%20JSONEachRow'
cat vmstat.dat | curl -X POST --data-binary @- 
"http://logos3:8123/?database=monitoring&query=${INSERT}"
(Or a Python script)
Step 4: Build a Grafana dashboard to show results
38
ClickHouse data source for Grafana Altinity plugin for ClickHouse
After loading you can go crazy with analytical queries
39
SELECT host, count() AS loaded_minutes
FROM (
SELECT
toStartOfMinute(timestamp) AS minute, host, avg(100 - id) AS load
FROM monitoring.vmstat
WHERE timestamp > (now() - toIntervalDay(1))
GROUP BY minute, host HAVING load > 25
)
GROUP BY host ORDER BY loaded_minutes DESC
โ”Œโ”€hostโ”€โ”€โ”€โ”ฌโ”€loaded_minutesโ”€โ”
โ”‚ logos3 โ”‚ 6 โ”‚
โ”‚ logos2 โ”‚ 5 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
2 hosts had > 25% load for at least
a minute in the last 24 hours
40
DEMO TIME!
Can ClickHouse store data in a โ€œschemalessโ€ way?
{{"timestamp":
"2023-01-23
19:53:14",
"host": "logos3",
...}
SQL Table
JSON
String
JSON String (โ€œblobโ€) with
derived header values
One table can handle
many entity types!
41
More schemaless ways to store data
SQL Table
Array
of
Keys
Arrays: Header values
with key-value pairs
Array
of
Values
SQL Table
Map
with
Key/Values
Map: Header values &
key value pairs
SQL Table
JSON
Data
Type
JSON data type mapped to
column storage
42
Where is the software to build monitoring?
43
Event streaming
โ— Apache Kafka
โ— Apache Pulsar
โ— Vectorized Redpanda
ELT
โ— Apache Air๏ฌ‚ow
โ— Rudderstack
Rendering/Display
โ— Apache Superset
โ— Cube.js
โ— Grafana
Client Libraries
โ— C++ - ClickHouse CPP
โ— Golang - ClickHouse Go
โ— Java - ClickHouse JDBC
โ— Javascript/Node.js - Apla
โ— ODBC - ODBC Driver for ClickHouse
โ— Python - ClickHouse Driver, ClickHouse
SQLAlchemy
More client library links HERE
Kubernetes
โ— Altinity Operator for ClickHouse
Where can I ๏ฌnd out more about ClickHouse?
ClickHouse of๏ฌcial docs โ€“ https://clickhouse.com/docs/
Altinity Blog โ€“ https://altinity.com/blog/
Altinity Youtube Channel โ€“
https://www.youtube.com/channel/UCE3Y2lDKl_ZfjaCrh62onYA
Altinity Knowledge Base โ€“ https://kb.altinity.com/
Meetups, other blogs, and external resources. Use your powers of Search!
44
Wrap-up
45
Comparing VictoriaMetrics and ClickHouse databases
VictoriaMetrics
Talks MetricsQL, PromQL, Graphite QL
Stores time series data
No explicit schema
Easy to load data using simple clients
Can pull data from Prometheus exporters and Kafka
Time-series speci๏ฌc functions and transformations
Integrates with any BI tool that speaks PromQL
Extremely fast and scalable
ClickHouse
Talks SQL
Stores any kind of data
Uses tables; many ways to represent data
Easy to load data using simple clients
Can pull data from Kafka and object storage
Versatile queries including JOIN and aggregation
Most BI tools have ClickHouse adapters
Extremely fast and scalable
46
Help for building monitoring systems that work
VictoriaMetrics Inc.
VictoriaMetrics Community
VictoriaMetrics Enterprise
VictoriaMetrics Managed platform
Altinity Inc.
Altinity.Cloud managed ClickHouse platform
Enterprise support for ClickHouse
Altinity Developer Academy classes
Altinity Stable Builds for ClickHouse
Altinity Kubernetes Operator for ClickHouse
47
Thank you!
Questions?
https://altinity.com
Contact Altinity
48
https://victoriametrics.com
Contact VictoriaMetrics

More Related Content

Similar to Application Monitoring using Open Source - VictoriaMetrics & Altinity ClickHouse Webinar.pdf

Similar to Application Monitoring using Open Source - VictoriaMetrics & Altinity ClickHouse Webinar.pdf (20)

Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek Docker Logging and analysing with Elastic Stack - Jakub Hajek
Docker Logging and analysing with Elastic Stack - Jakub Hajek
ย 
Docker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic StackDocker Logging and analysing with Elastic Stack
Docker Logging and analysing with Elastic Stack
ย 
KubeCon EU 2016 Keynote: Pushing Kubernetes Forward
KubeCon EU 2016 Keynote: Pushing Kubernetes ForwardKubeCon EU 2016 Keynote: Pushing Kubernetes Forward
KubeCon EU 2016 Keynote: Pushing Kubernetes Forward
ย 
Thinking DevOps in the era of the Cloud - Demi Ben-Ari
Thinking DevOps in the era of the Cloud - Demi Ben-AriThinking DevOps in the era of the Cloud - Demi Ben-Ari
Thinking DevOps in the era of the Cloud - Demi Ben-Ari
ย 
OpenTelemetry Introduction
OpenTelemetry Introduction OpenTelemetry Introduction
OpenTelemetry Introduction
ย 
Time series denver an introduction to prometheus
Time series denver   an introduction to prometheusTime series denver   an introduction to prometheus
Time series denver an introduction to prometheus
ย 
Developing and Deploying Apps with the Postgres FDW
Developing and Deploying Apps with the Postgres FDWDeveloping and Deploying Apps with the Postgres FDW
Developing and Deploying Apps with the Postgres FDW
ย 
ClickHouse Analytical DBMS. Introduction and usage, by Alexander Zaitsev
ClickHouse Analytical DBMS. Introduction and usage, by Alexander ZaitsevClickHouse Analytical DBMS. Introduction and usage, by Alexander Zaitsev
ClickHouse Analytical DBMS. Introduction and usage, by Alexander Zaitsev
ย 
Siddhi - cloud-native stream processor
Siddhi - cloud-native stream processorSiddhi - cloud-native stream processor
Siddhi - cloud-native stream processor
ย 
OpenTelemetry For Architects
OpenTelemetry For ArchitectsOpenTelemetry For Architects
OpenTelemetry For Architects
ย 
HBaseCon 2015: OpenTSDB and AsyncHBase Update
HBaseCon 2015: OpenTSDB and AsyncHBase UpdateHBaseCon 2015: OpenTSDB and AsyncHBase Update
HBaseCon 2015: OpenTSDB and AsyncHBase Update
ย 
OpenTSDB for monitoring @ Criteo
OpenTSDB for monitoring @ CriteoOpenTSDB for monitoring @ Criteo
OpenTSDB for monitoring @ Criteo
ย 
Monitoring as an entry point for collaboration
Monitoring as an entry point for collaborationMonitoring as an entry point for collaboration
Monitoring as an entry point for collaboration
ย 
Monitoring Big Data Systems - "The Simple Way"
Monitoring Big Data Systems - "The Simple Way"Monitoring Big Data Systems - "The Simple Way"
Monitoring Big Data Systems - "The Simple Way"
ย 
ql.io at NodePDX
ql.io at NodePDXql.io at NodePDX
ql.io at NodePDX
ย 
Sprint 78
Sprint 78Sprint 78
Sprint 78
ย 
Kusto (Azure Data Explorer) Training for R&D - January 2019
Kusto (Azure Data Explorer) Training for R&D - January 2019 Kusto (Azure Data Explorer) Training for R&D - January 2019
Kusto (Azure Data Explorer) Training for R&D - January 2019
ย 
Re-Engineering PostgreSQL as a Time-Series Database
Re-Engineering PostgreSQL as a Time-Series DatabaseRe-Engineering PostgreSQL as a Time-Series Database
Re-Engineering PostgreSQL as a Time-Series Database
ย 
Anaconda and PyData Solutions
Anaconda and PyData SolutionsAnaconda and PyData Solutions
Anaconda and PyData Solutions
ย 
Geospatial data platform at Uber
Geospatial data platform at UberGeospatial data platform at Uber
Geospatial data platform at Uber
ย 

More from Altinity Ltd

More from Altinity Ltd (20)

Building an Analytic Extension to MySQL with ClickHouse and Open Source.pptx
Building an Analytic Extension to MySQL with ClickHouse and Open Source.pptxBuilding an Analytic Extension to MySQL with ClickHouse and Open Source.pptx
Building an Analytic Extension to MySQL with ClickHouse and Open Source.pptx
ย 
Cloud Native ClickHouse at Scale--Using the Altinity Kubernetes Operator-2022...
Cloud Native ClickHouse at Scale--Using the Altinity Kubernetes Operator-2022...Cloud Native ClickHouse at Scale--Using the Altinity Kubernetes Operator-2022...
Cloud Native ClickHouse at Scale--Using the Altinity Kubernetes Operator-2022...
ย 
Building an Analytic Extension to MySQL with ClickHouse and Open Source
Building an Analytic Extension to MySQL with ClickHouse and Open SourceBuilding an Analytic Extension to MySQL with ClickHouse and Open Source
Building an Analytic Extension to MySQL with ClickHouse and Open Source
ย 
Fun with ClickHouse Window Functions-2021-08-19.pdf
Fun with ClickHouse Window Functions-2021-08-19.pdfFun with ClickHouse Window Functions-2021-08-19.pdf
Fun with ClickHouse Window Functions-2021-08-19.pdf
ย 
Cloud Native Data Warehouses - Intro to ClickHouse on Kubernetes-2021-07.pdf
Cloud Native Data Warehouses - Intro to ClickHouse on Kubernetes-2021-07.pdfCloud Native Data Warehouses - Intro to ClickHouse on Kubernetes-2021-07.pdf
Cloud Native Data Warehouses - Intro to ClickHouse on Kubernetes-2021-07.pdf
ย 
Building High Performance Apps with Altinity Stable Builds for ClickHouse | A...
Building High Performance Apps with Altinity Stable Builds for ClickHouse | A...Building High Performance Apps with Altinity Stable Builds for ClickHouse | A...
Building High Performance Apps with Altinity Stable Builds for ClickHouse | A...
ย 
Own your ClickHouse data with Altinity.Cloud Anywhere-2023-01-17.pdf
Own your ClickHouse data with Altinity.Cloud Anywhere-2023-01-17.pdfOwn your ClickHouse data with Altinity.Cloud Anywhere-2023-01-17.pdf
Own your ClickHouse data with Altinity.Cloud Anywhere-2023-01-17.pdf
ย 
ClickHouse ReplacingMergeTree in Telecom Apps
ClickHouse ReplacingMergeTree in Telecom AppsClickHouse ReplacingMergeTree in Telecom Apps
ClickHouse ReplacingMergeTree in Telecom Apps
ย 
Adventures with the ClickHouse ReplacingMergeTree Engine
Adventures with the ClickHouse ReplacingMergeTree EngineAdventures with the ClickHouse ReplacingMergeTree Engine
Adventures with the ClickHouse ReplacingMergeTree Engine
ย 
Building a Real-Time Analytics Application with Apache Pulsar and Apache Pinot
Building a Real-Time Analytics Application with  Apache Pulsar and Apache PinotBuilding a Real-Time Analytics Application with  Apache Pulsar and Apache Pinot
Building a Real-Time Analytics Application with Apache Pulsar and Apache Pinot
ย 
Altinity Webinar: Introduction to Altinity.Cloud-Platform for Real-Time Data.pdf
Altinity Webinar: Introduction to Altinity.Cloud-Platform for Real-Time Data.pdfAltinity Webinar: Introduction to Altinity.Cloud-Platform for Real-Time Data.pdf
Altinity Webinar: Introduction to Altinity.Cloud-Platform for Real-Time Data.pdf
ย 
OSA Con 2022 - What Data Engineering Can Learn from Frontend Engineering - Pe...
OSA Con 2022 - What Data Engineering Can Learn from Frontend Engineering - Pe...OSA Con 2022 - What Data Engineering Can Learn from Frontend Engineering - Pe...
OSA Con 2022 - What Data Engineering Can Learn from Frontend Engineering - Pe...
ย 
OSA Con 2022 - Welcome to OSA CON Version 2022 - Robert Hodges - Altinity.pdf
OSA Con 2022 - Welcome to OSA CON Version 2022 - Robert Hodges - Altinity.pdfOSA Con 2022 - Welcome to OSA CON Version 2022 - Robert Hodges - Altinity.pdf
OSA Con 2022 - Welcome to OSA CON Version 2022 - Robert Hodges - Altinity.pdf
ย 
OSA Con 2022 - Using ClickHouse Database to Power Analytics and Customer Enga...
OSA Con 2022 - Using ClickHouse Database to Power Analytics and Customer Enga...OSA Con 2022 - Using ClickHouse Database to Power Analytics and Customer Enga...
OSA Con 2022 - Using ClickHouse Database to Power Analytics and Customer Enga...
ย 
OSA Con 2022 - Tips and Tricks to Keep Your Queries under 100ms with ClickHou...
OSA Con 2022 - Tips and Tricks to Keep Your Queries under 100ms with ClickHou...OSA Con 2022 - Tips and Tricks to Keep Your Queries under 100ms with ClickHou...
OSA Con 2022 - Tips and Tricks to Keep Your Queries under 100ms with ClickHou...
ย 
OSA Con 2022 - The Open Source Analytic Universe, Version 2022 - Robert Hodge...
OSA Con 2022 - The Open Source Analytic Universe, Version 2022 - Robert Hodge...OSA Con 2022 - The Open Source Analytic Universe, Version 2022 - Robert Hodge...
OSA Con 2022 - The Open Source Analytic Universe, Version 2022 - Robert Hodge...
ย 
OSA Con 2022 - Switching Jaeger Distributed Tracing to ClickHouse to Enable A...
OSA Con 2022 - Switching Jaeger Distributed Tracing to ClickHouse to Enable A...OSA Con 2022 - Switching Jaeger Distributed Tracing to ClickHouse to Enable A...
OSA Con 2022 - Switching Jaeger Distributed Tracing to ClickHouse to Enable A...
ย 
OSA Con 2022 - Streaming Data Made Easy - Tim Spann & David Kjerrumgaard - St...
OSA Con 2022 - Streaming Data Made Easy - Tim Spann & David Kjerrumgaard - St...OSA Con 2022 - Streaming Data Made Easy - Tim Spann & David Kjerrumgaard - St...
OSA Con 2022 - Streaming Data Made Easy - Tim Spann & David Kjerrumgaard - St...
ย 
OSA Con 2022 - State of Open Source Databases - Peter Zaitsev - Percona.pdf
OSA Con 2022 - State of Open Source Databases - Peter Zaitsev - Percona.pdfOSA Con 2022 - State of Open Source Databases - Peter Zaitsev - Percona.pdf
OSA Con 2022 - State of Open Source Databases - Peter Zaitsev - Percona.pdf
ย 
OSA Con 2022 - Specifics of data analysis in Time Series Databases - Roman Kh...
OSA Con 2022 - Specifics of data analysis in Time Series Databases - Roman Kh...OSA Con 2022 - Specifics of data analysis in Time Series Databases - Roman Kh...
OSA Con 2022 - Specifics of data analysis in Time Series Databases - Roman Kh...
ย 

Recently uploaded

Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...
amitlee9823
ย 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
SUHANI PANDEY
ย 
Call Girls Indiranagar Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service B...
Call Girls Indiranagar Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service B...Call Girls Indiranagar Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service B...
Call Girls Indiranagar Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service B...
amitlee9823
ย 
CHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
Call Girls Hsr Layout Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service Ba...
amitlee9823
ย 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
Delhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip Call
shivangimorya083
ย 

Recently uploaded (20)

Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdfMarket Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
Market Analysis in the 5 Largest Economic Countries in Southeast Asia.pdf
ย 
Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Ser...
ย 
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
(NEHA) Call Girls Katra Call Now 8617697112 Katra Escorts 24x7
ย 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
ย 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
ย 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
ย 
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
ย 
Call Girls Indiranagar Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service B...
Call Girls Indiranagar Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service B...Call Girls Indiranagar Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service B...
Call Girls Indiranagar Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service B...
ย 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
ย 
BDSMโšกCall Girls in Mandawali Delhi >เผ’8448380779 Escort Service
BDSMโšกCall Girls in Mandawali Delhi >เผ’8448380779 Escort ServiceBDSMโšกCall Girls in Mandawali Delhi >เผ’8448380779 Escort Service
BDSMโšกCall Girls in Mandawali Delhi >เผ’8448380779 Escort Service
ย 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
ย 
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
Best VIP Call Girls Noida Sector 22 Call Me: 8448380779
ย 
Edukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFxEdukaciniai dropshipping via API with DroFx
Edukaciniai dropshipping via API with DroFx
ย 
CHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICECHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Saket (-DELHI )๐Ÿ” 9953056974๐Ÿ”(=)/CALL GIRLS SERVICE
ย 
Ravak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptxRavak dropshipping via API with DroFx.pptx
Ravak dropshipping via API with DroFx.pptx
ย 
Call Girls Hsr Layout Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call ๐Ÿ‘— 7737669865 ๐Ÿ‘— Top Class Call Girl Service Ba...
ย 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
ย 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
ย 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
ย 
Delhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 โ˜Žโœ”๐Ÿ‘Œโœ” Whatsapp Hard And Sexy Vip Call
ย 

Application Monitoring using Open Source - VictoriaMetrics & Altinity ClickHouse Webinar.pdf

  • 1. Build Fast, Scalable App Monitoring with Open Source Robert Hodges - Altinity Roman Khavronenko - VictoriaMetrics 1
  • 2. Letโ€™s make some introductions 2 Robert Hodges Database geek with 30+ years on DBMS systems. Day job: CEO at Altinity Roman Khavronenko Distributed systems and monitoring engineer. Day job: SE at VictoriaMetrics
  • 4. Monitoring is for answering questions โ— Why users are getting errors? โ— When it started? โ— How many users are affected? โ— Which service is failing? 4
  • 5. To get an answer to the question you need 3 things 1. The question 2. The information to process 3. The respondent 5
  • 6. 6
  • 7. 7
  • 8. 8
  • 9. 9
  • 10. 10
  • 12. VictoriaMetrics - Open Source Time Series Database & Monitoring Solution โ— Vertically and horizontally scalable โ— Operational simplicity โ— Cost-ef๏ฌcient โ— Prometheus compatible โ— Free forever 12
  • 13. VictoriaMetrics - Open Source Time Series Database & Monitoring Solution โ— Kubernetes monitoring โ— Hardware and infrastructure monitoring โ— Application Performance Monitoring (APM) โ— IoT โ— Edge computing โ— Alerting 13
  • 14. 14
  • 15. Metric is a numeric measure or observation of something: โ— Number of served requests โ— Requests latency โ— CPU or memory usage โ— Occupied or free disk space What is a metric? 15
  • 17. Storage for metrics 17 โ— VictoriaMetrics data model is schemaless โ— No need to de๏ฌne metric names or their labels in advance โ— User is free to add or change ingested metrics anytime.
  • 19. OSA Con 2021: How ClickHouse Inspired Us to Build a High Performance TSDB โ— VictoriaMetrics is specialized solution for time series data โ— Compression reaches 0.4 Bytes per sample โ— Ingestions speed 300k samples/s per CPU core โ— Scanning speed 50Mil samples/s per CPU core 19
  • 21. > curl -d "requests_total{path="/",code="200"} 10" -X POST http://victoriametrics/api/v1/import/prometheus 21
  • 22. More than one protocol for metrics โ— Prometheus remote write API. โ— Prometheus text exposition format. โ— DataDog protocol. โ— In๏ฌ‚uxDB line protocol over HTTP, TCP and UDP. โ— Graphite plaintext protocol with tags. โ— OpenTSDB put message. โ— HTTP OpenTSDB /api/put requests. โ— JSON line format. โ— Arbitrary CSV data. 22
  • 25. Demo time! โ— Run VictoriaMetrics โ— Write some metrics โ— Execute read queries 25
  • 26. Frequently asked questions โ— Can I monitor MySQL Server, Postgres, MongoDB, ClickHouse? โ—‹ Yes, there are plenty of exporters, dashboards and alerting rules there. โ— Can I monitor my applications? โ—‹ Yes, there are libraries for multiple programming languages to instrument the application with metrics. โ— How expensive monitoring is? โ—‹ With VictoriaMetrics, cost of storing metrics from 100 instances, each instance emits 1000 metrics every 30s for the total cost will be: โ–  100GB of disk space $0.045 per GB-month: 100*0.045*12 = $54 โ–  One t3.medium instance, $0.0418 per hour: 0.0418*730*12 = $366 โ–  Total: $420 per year for monitoring 100 instances. โ— Can I run it in Kubernetes? โ—‹ Sure! We have k8s operator and helm charts for VictoriaMetrics! 26
  • 28. ClickHouse: a real-time analytic database It understands SQL Itโ€™s Apache 2.0 It handles many use cases beyond monitoring It also handles time series data very well 28
  • 29. ClickHouse optimizes for fast response on large datasets 29 Highly compressed column storage with indexing Automatic replication between nodes SELECT host, avg(idle) FROM vmstat GROUP BY host Parallelized/vectorized query Table replica
  • 30. ClickHouse can load millions of events per second 30 Unaggregated event data Source data table(s) Parallel load Event Queue (Kafka) Custom Application Data Lake (S3, HDFS) Precomputed aggregates Precomputed aggregates Precomputed aggregates Materialized views Instantly queryable
  • 31. โ€ฆAnd supports [many] dozens of input formats 31 INSERT INTO some_table Format <format> TabSeparated TabSeparatedWithNames CSV CSVWithNames CustomSeparated Values JSON JSONEachRow Protobuf Parquet ...
  • 32. There are many ways to store and manipulate time data Date -- Precision to day DateTime -- Precision to second DateTime64 -- Precision to nanosecond toYear(), toMonth(), toWeek(), toDayOfWeek, toDay(), toHour(), ... toStartOfYear(), toStartOfQuarter(), toStartOfMonth(), toStartOfHour(), toStartOfMinute(), โ€ฆ, toStartOfInterval() toYYYYMM() toYYYYMMDD() toYYYYMMDDhhmmsss() And many more! 32 BI tools like Grafana like DateTime values
  • 33. Letโ€™s build a simple host monitoring system 33 $ vmstat 1 -n procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 166912 2645740 36792 3360652 0 0 3 101 1 1 2 1 98 0 0 1 0 166912 2645360 36792 3360652 0 0 0 0 1182 3986 7 1 93 0 0 ClickHouse Grafana Dashboard
  • 34. Step 1: Generate vmstat data 34 #!/usr/bin/env python3 import datetime, json, socket, subprocess host = socket.gethostname() with subprocess.Popen(['vmstat', '-n', '1'], stdout=subprocess.PIPE) as proc: proc.stdout.readline() # discard first line header_names = proc.stdout.readline().decode().split() values = proc.stdout.readline().decode() while values != '' and proc.poll() is None: dict = {} dict['timestamp'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") dict['host'] = host for (header, value) in zip(header_names, values.split()): dict[header] = int(value) print(json.dumps(dict), flush=True) values = proc.stdout.readline().decode()
  • 35. Hereโ€™s the output 35 {"timestamp": "2023-01-22 18:13:16", "host": "logos3", "r": 0, "b": 0, "swpd": 166912, "free": 2523688, "buff": 41412, "cache": 3408292, "si": 0, "so": 0, "bi": 3, "bo": 101, "in": 1, "cs": 0, "us": 2, "sy": 1, "id": 98, "wa": 0, "st": 0} {"timestamp": "2023-01-22 18:13:17", "host": "logos3", "r": 0, "b": 0, "swpd": 166912, "free": 2523696, "buff": 41412, "cache": 3408316, "si": 0, "so": 0, "bi": 0, "bo": 216, "in": 1214, "cs": 4320, "us": 1, "sy": 1, "id": 98, "wa": 0, "st": 0} {"timestamp": "2023-01-22 18:13:18", "host": "logos3", "r": 0, "b": 0, "swpd": 166912, "free": 2527120, "buff": 41412, "cache": 3408572, "si": 0, "so": 0, "bi": 0, "bo": 0, "in": 1172, "cs": 4162, "us": 2, "sy": 1, "id": 98, "wa": 0, "st": 0}
  • 36. Step 2: Design a ClickHouse table to hold data 36 CREATE TABLE monitoring.vmstat ( timestamp DateTime, day UInt32 default toYYYYMMDD(timestamp), host String, r UInt64, b UInt64, -- procs swpd UInt64, free UInt64, buff UInt64, cache UInt64, -- memory si UInt64, so UInt64, -- swap bi UInt64, bo UInt64, -- io in UInt64, cs UInt64, -- system us UInt64, sy UInt64, id UInt64, wa UInt64, st UInt64 -- cpu ) ENGINE=MergeTree PARTITION BY day ORDER BY (host, timestamp) Dimensions Measurements
  • 37. Step 3: Load data into ClickHouse 37 INSERT INTO vmstat Format JSONEachRow E.g. INSERT='INSERT%20INTO%20vmstat%20Format%20JSONEachRow' cat vmstat.dat | curl -X POST --data-binary @- "http://logos3:8123/?database=monitoring&query=${INSERT}" (Or a Python script)
  • 38. Step 4: Build a Grafana dashboard to show results 38 ClickHouse data source for Grafana Altinity plugin for ClickHouse
  • 39. After loading you can go crazy with analytical queries 39 SELECT host, count() AS loaded_minutes FROM ( SELECT toStartOfMinute(timestamp) AS minute, host, avg(100 - id) AS load FROM monitoring.vmstat WHERE timestamp > (now() - toIntervalDay(1)) GROUP BY minute, host HAVING load > 25 ) GROUP BY host ORDER BY loaded_minutes DESC โ”Œโ”€hostโ”€โ”€โ”€โ”ฌโ”€loaded_minutesโ”€โ” โ”‚ logos3 โ”‚ 6 โ”‚ โ”‚ logos2 โ”‚ 5 โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ 2 hosts had > 25% load for at least a minute in the last 24 hours
  • 41. Can ClickHouse store data in a โ€œschemalessโ€ way? {{"timestamp": "2023-01-23 19:53:14", "host": "logos3", ...} SQL Table JSON String JSON String (โ€œblobโ€) with derived header values One table can handle many entity types! 41
  • 42. More schemaless ways to store data SQL Table Array of Keys Arrays: Header values with key-value pairs Array of Values SQL Table Map with Key/Values Map: Header values & key value pairs SQL Table JSON Data Type JSON data type mapped to column storage 42
  • 43. Where is the software to build monitoring? 43 Event streaming โ— Apache Kafka โ— Apache Pulsar โ— Vectorized Redpanda ELT โ— Apache Air๏ฌ‚ow โ— Rudderstack Rendering/Display โ— Apache Superset โ— Cube.js โ— Grafana Client Libraries โ— C++ - ClickHouse CPP โ— Golang - ClickHouse Go โ— Java - ClickHouse JDBC โ— Javascript/Node.js - Apla โ— ODBC - ODBC Driver for ClickHouse โ— Python - ClickHouse Driver, ClickHouse SQLAlchemy More client library links HERE Kubernetes โ— Altinity Operator for ClickHouse
  • 44. Where can I ๏ฌnd out more about ClickHouse? ClickHouse of๏ฌcial docs โ€“ https://clickhouse.com/docs/ Altinity Blog โ€“ https://altinity.com/blog/ Altinity Youtube Channel โ€“ https://www.youtube.com/channel/UCE3Y2lDKl_ZfjaCrh62onYA Altinity Knowledge Base โ€“ https://kb.altinity.com/ Meetups, other blogs, and external resources. Use your powers of Search! 44
  • 46. Comparing VictoriaMetrics and ClickHouse databases VictoriaMetrics Talks MetricsQL, PromQL, Graphite QL Stores time series data No explicit schema Easy to load data using simple clients Can pull data from Prometheus exporters and Kafka Time-series speci๏ฌc functions and transformations Integrates with any BI tool that speaks PromQL Extremely fast and scalable ClickHouse Talks SQL Stores any kind of data Uses tables; many ways to represent data Easy to load data using simple clients Can pull data from Kafka and object storage Versatile queries including JOIN and aggregation Most BI tools have ClickHouse adapters Extremely fast and scalable 46
  • 47. Help for building monitoring systems that work VictoriaMetrics Inc. VictoriaMetrics Community VictoriaMetrics Enterprise VictoriaMetrics Managed platform Altinity Inc. Altinity.Cloud managed ClickHouse platform Enterprise support for ClickHouse Altinity Developer Academy classes Altinity Stable Builds for ClickHouse Altinity Kubernetes Operator for ClickHouse 47