SlideShare a Scribd company logo
OPTIMIZING THE TICK STACK
Agenda: New Practitioners Track
WORKSHOPAGENDA
8:00 AM – 9:00 AM Breakfast
9:00 AM – 10:00 AM Installing the TICK Stack and Your First Query Noah Crowley
10:00 AM – 10:50 AM Chronograf and Dashboarding David Simmons
10:50 AM – 11:20 AM Break
11:20 AM – 12:10 PM Writing Queries (InfluxQL and TICK) Noah Crowley
12:10 PM – 1:10 PM Lunch
1:10 PM – 2:00 PM Architecting InfluxEnterprise for Success Dean Sheehan
2:00 PM – 2:10 PM Break
2:10 PM – 3:00 PM Optimizing the TICK Stack Dean Sheehan
3:10 PM – 4:00 PM Downsampling Data Michael DeSa
4:00 PM Happy Hour
Dean Sheehan
Senior Director, Pre and
Post Sales
Optimizing the TICK Stack
• What shape is your data?
• Ingest optimization
• Query considerations
• Offloading stream processing
Line protocol
Schema Design
The Line Protocol
• Self describing data
– Points are written to InfluxDB using the Line Protocol, which follows the following format:
<measurement>[,<tag-key>=<tag-value>] [<field-key>=<field-value>] [unix-nano-timestamp]
– This provides extremely high flexibility as new metrics are identified for collection into
InfluxDB. New measure to capture? Just send it to InfluxDB. It’s that easy.
cpu_load,hostname=server02,az=us_west usage_user=24.5,usage_idle=15.3 1234567890000000
Measurement
Tag
Set
Field Set
Timestamp
DON'T ENCODE DATA INTO THE MEASUREMENT NAME
• Measurement names like:
• Encode that information as tags:
cpu.server-5.us-west value=2 1444234982000000000
cpu.server-6.us-west value=4 1444234982000000000
mem-free.server-6.us-west value=2500 1444234982000000000
cpu,host=server-5,region=us-west value=2 1444234982000000000
cpu,host=server-6,region=us-west value=4 1444234982000000000
mem-free,host=server-6,region=us-west value=2500 1444234982000000
What if my plugin sends data like that to InfluxDB?
Write something that sits between your plugin and InfluxDB to sanitize the data OR
use one of our write plugins:
Example - Telegraf’s Graphite input plugin: Takes input like…
…and parses it with the following template…
…resulting in the following points in line protocol hitting the database:
sensu.metric.net.server0.eth0.rx_packets 461295119435 1444234982
sensu.metric.net.server0.eth0.tx_bytes 1093086493388480 1444234982
sensu.metric.net.server0.eth0.rx_bytes 1015633926034834 1444234982
["sensu.metric.* ..measurement.host.interface.field"]
net,host=server0,interface=eth0 rx_packets=461295119435 1444234982
net,host=server0,interface=eth0 tx_bytes=1093086493388480 1444234982
net,host=server0,interface=eth0 rx_bytes=1015633926034834 1444234982
Things to
remember
● Tags are Indexed
● Fields are not
● All points are indexed by
time
DON’T OVERLOAD TAGS
• BAD
• GOOD: Separate out into different tags:
cpu,server=localhost.us-west value=2 1444234982000000000
cpu,server=localhost.us-east value=3 1444234982000000000
cpu,host=localhost,region=us-west value=2 1444234982000000000
cpu,host=localhost,region=us-east value=3 1444234982000000000
DON’T USE THE SAME NAME FOR A FIELD AND A TAG
• BAD: This significantly complicates queries.
• GOOD: Differentiate the names somehow:
login,user=admin user=2342,success=1 1444234982000
SELECT user::field, user::tag FROM login
login,role=admin user=2342,success=1 1444234982000
DON'T USE TOO FEW TAGS
• BAD
• Problems you might run into:
• Fields are not indexed, so queries with field conditions have to scan every
point.
• GROUP BY <field> is not valid, you can only GROUPBY <tag>
cpu,region=us-west host="server1",value=4,temp=2 1444234982000
cpu,region=us-west host="server2",value=1,other=14 1444234982000
DON'T CREATE TOO MANY LOGICAL CONTAINERS
Or rather, don’t write to too many databases:
• Dozens of databases should be fine
• hundreds might be okay
• thousands probably aren't without careful design
Too many databases leads to more open files, more query
iterators in RAM, and more shards expiring. Expiring shards have
a non-trivial RAM and CPU cost to clean up the indices.
OR MEASURMENTS
The Last Writes Wins!
• InfluxDB only stores one value for a given series
• ‘Given’ series meaning what?
– {Measurment,TagSet,Timestamp}
• If you send in another entry for same {M,TS,T}
– Result is union of previous and new field values
Worked Example
Internet Of Things – City Air Quality
• There are 10k sensor units that measure
• Smog, Carbon Dioxide, Lead and Sulfur Dioxide
• at different locations throughout a city
• Sensor units send measurements to Influx every 10 seconds
• IOT people like to think in Hertz, that would be 0.1Hz
Sensor data
• zip_code Zipcode of the sensor location
city Name of the city
lat Latitude of the sensor
lng Longitude of the sensor
device_id UUID of the device
smog_level Smog level measurement
co2_ppm CO2 parts per million
measurement
lead Atmospheric lead level
measurement
so2_level Sulfur Dioxide level
measurement
Exercise
Why would it be a bad idea to make lat or lng a tag instead of a
field?
Solution
• Why would it be a bad idea to make lat or lng a tag instead of a
field?
– Numeric Property: We probably care about doing math on lat and lng.
That can only work if they are fields.
Exercise
Why would it be a good idea to make lat or lng a tag instead of a
field?
Solution
• Why would it be a good idea to make lat or lng a tag instead of a
field?
– We probably care about filtering or grouping by lat and lng. Filters are
faster with tags, and only tags are valid for grouping.
– If our devices don't move, lat and lng are dependent tags on device_id.
Storing them as tags won't increase series cardinality.
• Keep in mind that you can’t do any of the numeric computations
on tags
The following queries are important
SELECT median(lead) FROM pollutants
WHERE time > now() - 1d GROUP BY city
SELECT mean(co2_ppm) FROM pollutants
WHERE time > now() - 1d AND city='sf' GROUP BY device_id
SELECT max(smog_level) FROM pollutants
WHERE time > now() - 1d AND city='nyc' GROUP BY zipcode
SELECT min(so2_level) FROM pollutants
WHERE time > now() - 1d AND city='nyc' GROUP BY zipcode
Question
How can we organize our data to support the queries that we want?
Schema 1 for Pollutants
measurement: pollutants
tags: city device_id zipcode
fields: lat lng smog_level co2_ppm lead so2_level
Examples in Line Protocol
pollutants,
city=richmond,device_id=12,zipcode=23221
lat=37.5333,lng=77.4667,smog_level=2.4,co2_ppm=404i,lead=2.3,so2_level=3i
142309324834700
pollutants,
city=bozeman,device_id=37,zipcode=59715
lat=45.6778,lng=111.0472,smog_level=0.9,co2_ppm=398i,lead=1.3,so2_level=1i
142309324834700
Schema 2 for Pollutants
measurement: pollutants
tags: lat lng city device_id zipcode
fields: smog_level co2_ppm lead so2_level
Examples in Line Protocol
pollutants,
city=richmond,device_id=12,zipcode=23221,lat=37.5333,lng=77.4667
smog_level=2.4,co2_ppm=404i,lead=2.3,so2_level=3i
142309324834700
pollutants,
city=bozeman,device_id=37,zipcode=59715,lat=45.6778,lng=111.0472
smog_level=0.9,co2_ppm=398i,lead=1.3,so2_level=1i
142309324834700
Queries and data on disk
• Shards have a duration
• Queries that touch more shards run slower
• Look to configure a shard duration that means queries are
typically answered from few (1) shards
• We recommend configuring the shard group duration such that:
– It is two times your longest typical query’s time range
– Each shard group has at least 100,000 points
– Each shard group has at least 1,000 points per series
Time Series Index
• You have a choice
– Inmemory index
– Memory mapped (to disk) index – Time Series Index
• Inmemory Index has limits
– How much memory do you have?
– Needs rebuild on restart
• Time Series Index uses disk
– Little slower in some situations
– Upside is how much disk do you have compared to memory (and restart
speed)
Optimizing ingestion
• Batch your writes if possible
– Something like 5000 points per batch
• Be mindful of thundering heard
– Boat load of data from hundreds of sources at same second
– Jitter
Aggregate inputs
Telegraf Telegraf TelegrafTelegraf Telegraf
Telegraf Telegraf TelegrafTelegraf Telegraf
Telegraf Telegraf TelegrafTelegraf Telegraf
Telegraf TelegrafTelegraf
Query considerations
• Time bound
– We’re a time series database after all
• Query large, return small
– Human consumers don’t work well with large amounts of data
– Machine consumers – maybe but the more you can ask InfluxDB to do
the better
• Use tags
– Comes back to thinking about your schema early on
• Can’t win them all
Offload stream processing
• You can clearly run queries periodically to look for worrying
situations
– And generate alarms in your calling code
• Be respectful of the DB engine, it is working hard to store your
data and answer important queries
• Some ‘queries’ might be better handled by observing and
operating on the stream of data InfluxDB sees
• Kapacitor ‘subscribes’ to InfluxDB
Other pearls
• Query limit configuration
• max-concurrent-queries
• max-select-point
• max-select-series
• Queries
• Reminder time-series queries - should always include time
• Backfilling data
• Insert data ordered by timestamp/tags - newest to oldest

More Related Content

PPTX
And Then There Are Algorithms
InfluxData
 
PPTX
ARCHITECTING INFLUXENTERPRISE FOR SUCCESS
InfluxData
 
PDF
OPTIMIZING THE TICK STACK
InfluxData
 
PPTX
How to Introduce Telemetry Streaming (gNMI) in Your Network with SNMP with Te...
InfluxData
 
PPTX
Frossie Economou & Angelo Fausti [Vera C. Rubin Observatory] | How InfluxDB H...
InfluxData
 
PPTX
How Texas Instruments Uses InfluxDB to Uphold Product Standards and to Improv...
InfluxData
 
PDF
TPC-DS performance evaluation for JAQL and PIG queries - Andrii Vozniuk, Serg...
Andrii Vozniuk
 
PDF
Streaming SQL (at FlinkForward, Berlin, 2016/09/12)
Julian Hyde
 
And Then There Are Algorithms
InfluxData
 
ARCHITECTING INFLUXENTERPRISE FOR SUCCESS
InfluxData
 
OPTIMIZING THE TICK STACK
InfluxData
 
How to Introduce Telemetry Streaming (gNMI) in Your Network with SNMP with Te...
InfluxData
 
Frossie Economou & Angelo Fausti [Vera C. Rubin Observatory] | How InfluxDB H...
InfluxData
 
How Texas Instruments Uses InfluxDB to Uphold Product Standards and to Improv...
InfluxData
 
TPC-DS performance evaluation for JAQL and PIG queries - Andrii Vozniuk, Serg...
Andrii Vozniuk
 
Streaming SQL (at FlinkForward, Berlin, 2016/09/12)
Julian Hyde
 

What's hot (20)

PPTX
Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
DataWorks Summit
 
PDF
FlinkDTW: Time-series Pattern Search at Scale Using Dynamic Time Warping - Ch...
Flink Forward
 
PDF
SignalFx: Making Cassandra Perform as a Time Series Database
DataStax Academy
 
PDF
Care and Feeding of Large Scale Graphite Installations - DevOpsDays Austin 2013
Nick Galbreath
 
PDF
Kenneth Knowles - Apache Beam - A Unified Model for Batch and Streaming Data...
Flink Forward
 
PDF
Realtime Risk Management Using Kafka, Python, and Spark Streaming by Nick Evans
Spark Summit
 
PDF
How to Build a Telegraf Plugin by Noah Crowley
InfluxData
 
PDF
Flink Forward Berlin 2017: Pramod Bhatotia, Do Le Quoc - StreamApprox: Approx...
Flink Forward
 
PDF
Virtual training Intro to the Tick stack and InfluxEnterprise
InfluxData
 
PPTX
Till Rohrmann – Fault Tolerance and Job Recovery in Apache Flink
Flink Forward
 
PPTX
Databricks clusters in autopilot mode
Prakash Chockalingam
 
PPTX
Building Modern Data Pipelines for Time Series Data on GCP with InfluxData by...
InfluxData
 
PDF
Real Time Data Streaming using Kafka & Storm
Ran Silberman
 
PDF
Creating and Using the Flux SQL Datasource | Katy Farmer | InfluxData
InfluxData
 
PDF
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...
Dan Halperin
 
PPTX
Large-scaled telematics analytics
DataWorks Summit
 
PPTX
Kapacitor - Real Time Data Processing Engine
Prashant Vats
 
PPTX
Fraud Detection for Israel BigThings Meetup
Gwen (Chen) Shapira
 
PDF
Stream Processing in Uber
C4Media
 
PDF
Big Data Day LA 2016/ Big Data Track - Portable Stream and Batch Processing w...
Data Con LA
 
Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
DataWorks Summit
 
FlinkDTW: Time-series Pattern Search at Scale Using Dynamic Time Warping - Ch...
Flink Forward
 
SignalFx: Making Cassandra Perform as a Time Series Database
DataStax Academy
 
Care and Feeding of Large Scale Graphite Installations - DevOpsDays Austin 2013
Nick Galbreath
 
Kenneth Knowles - Apache Beam - A Unified Model for Batch and Streaming Data...
Flink Forward
 
Realtime Risk Management Using Kafka, Python, and Spark Streaming by Nick Evans
Spark Summit
 
How to Build a Telegraf Plugin by Noah Crowley
InfluxData
 
Flink Forward Berlin 2017: Pramod Bhatotia, Do Le Quoc - StreamApprox: Approx...
Flink Forward
 
Virtual training Intro to the Tick stack and InfluxEnterprise
InfluxData
 
Till Rohrmann – Fault Tolerance and Job Recovery in Apache Flink
Flink Forward
 
Databricks clusters in autopilot mode
Prakash Chockalingam
 
Building Modern Data Pipelines for Time Series Data on GCP with InfluxData by...
InfluxData
 
Real Time Data Streaming using Kafka & Storm
Ran Silberman
 
Creating and Using the Flux SQL Datasource | Katy Farmer | InfluxData
InfluxData
 
Introduction to Apache Beam & No Shard Left Behind: APIs for Massive Parallel...
Dan Halperin
 
Large-scaled telematics analytics
DataWorks Summit
 
Kapacitor - Real Time Data Processing Engine
Prashant Vats
 
Fraud Detection for Israel BigThings Meetup
Gwen (Chen) Shapira
 
Stream Processing in Uber
C4Media
 
Big Data Day LA 2016/ Big Data Track - Portable Stream and Batch Processing w...
Data Con LA
 
Ad

Similar to OPTIMIZING THE TICK STACK (20)

PDF
OPTIMIZING THE TICK STACK
InfluxData
 
PDF
Virtual training optimizing the tick stack
InfluxData
 
PPTX
InfluxDB 1.0 - Optimizing InfluxDB by Sam Dillard
InfluxData
 
PDF
Paul Dix [InfluxData] The Journey of InfluxDB | InfluxDays 2022
InfluxData
 
PDF
Timeseries - data visualization in Grafana
OCoderFest
 
PPTX
InfluxDB 101 – Concepts and Architecture by Michael DeSa, Software Engineer |...
InfluxData
 
PDF
Optimizing InfluxDB Performance in the Real World by Dean Sheehan, Senior Dir...
InfluxData
 
PDF
Optimizing InfluxDB Performance in the Real World | Sam Dillard | InfluxData
InfluxData
 
PDF
Best Practices: How to Analyze IoT Sensor Data with InfluxDB
InfluxData
 
PDF
Paul Dix (Founder InfluxDB) - Organising Metrics at #DOXLON
Outlyer
 
PDF
Intro to Time Series
InfluxData
 
PDF
Time Series Databases for IoT (On-premises and Azure)
Ivo Andreev
 
PDF
InfluxDB 101 - Concepts and Architecture | Michael DeSa | InfluxData
InfluxData
 
PDF
Flux QL - Nexgen Management of Time Series Inspired by JS
Ivo Andreev
 
PDF
Influxdb and time series data
Marcin Szepczyński
 
PDF
InfluxDB Internals
InfluxData
 
PDF
Virtual training intro to InfluxDB - June 2021
InfluxData
 
PDF
Intro to InfluxDB
InfluxData
 
PDF
Optimizing Time Series Performance in the Real World
DevOps.com
 
PDF
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Fastly
 
OPTIMIZING THE TICK STACK
InfluxData
 
Virtual training optimizing the tick stack
InfluxData
 
InfluxDB 1.0 - Optimizing InfluxDB by Sam Dillard
InfluxData
 
Paul Dix [InfluxData] The Journey of InfluxDB | InfluxDays 2022
InfluxData
 
Timeseries - data visualization in Grafana
OCoderFest
 
InfluxDB 101 – Concepts and Architecture by Michael DeSa, Software Engineer |...
InfluxData
 
Optimizing InfluxDB Performance in the Real World by Dean Sheehan, Senior Dir...
InfluxData
 
Optimizing InfluxDB Performance in the Real World | Sam Dillard | InfluxData
InfluxData
 
Best Practices: How to Analyze IoT Sensor Data with InfluxDB
InfluxData
 
Paul Dix (Founder InfluxDB) - Organising Metrics at #DOXLON
Outlyer
 
Intro to Time Series
InfluxData
 
Time Series Databases for IoT (On-premises and Azure)
Ivo Andreev
 
InfluxDB 101 - Concepts and Architecture | Michael DeSa | InfluxData
InfluxData
 
Flux QL - Nexgen Management of Time Series Inspired by JS
Ivo Andreev
 
Influxdb and time series data
Marcin Szepczyński
 
InfluxDB Internals
InfluxData
 
Virtual training intro to InfluxDB - June 2021
InfluxData
 
Intro to InfluxDB
InfluxData
 
Optimizing Time Series Performance in the Real World
DevOps.com
 
Altitude NY 2018: Leveraging Log Streaming to Build the Best Dashboards, Ever
Fastly
 
Ad

More from InfluxData (20)

PPTX
Announcing InfluxDB Clustered
InfluxData
 
PDF
Best Practices for Leveraging the Apache Arrow Ecosystem
InfluxData
 
PDF
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
InfluxData
 
PDF
Power Your Predictive Analytics with InfluxDB
InfluxData
 
PDF
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
InfluxData
 
PDF
Build an Edge-to-Cloud Solution with the MING Stack
InfluxData
 
PDF
Meet the Founders: An Open Discussion About Rewriting Using Rust
InfluxData
 
PDF
Introducing InfluxDB Cloud Dedicated
InfluxData
 
PDF
Gain Better Observability with OpenTelemetry and InfluxDB
InfluxData
 
PPTX
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
InfluxData
 
PDF
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
InfluxData
 
PPTX
Introducing InfluxDB’s New Time Series Database Storage Engine
InfluxData
 
PDF
Start Automating InfluxDB Deployments at the Edge with balena
InfluxData
 
PDF
Understanding InfluxDB’s New Storage Engine
InfluxData
 
PDF
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
InfluxData
 
PPTX
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
InfluxData
 
PDF
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
InfluxData
 
PDF
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
InfluxData
 
PDF
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
InfluxData
 
PDF
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
InfluxData
 
Announcing InfluxDB Clustered
InfluxData
 
Best Practices for Leveraging the Apache Arrow Ecosystem
InfluxData
 
How Bevi Uses InfluxDB and Grafana to Improve Predictive Maintenance and Redu...
InfluxData
 
Power Your Predictive Analytics with InfluxDB
InfluxData
 
How Teréga Replaces Legacy Data Historians with InfluxDB, AWS and IO-Base
InfluxData
 
Build an Edge-to-Cloud Solution with the MING Stack
InfluxData
 
Meet the Founders: An Open Discussion About Rewriting Using Rust
InfluxData
 
Introducing InfluxDB Cloud Dedicated
InfluxData
 
Gain Better Observability with OpenTelemetry and InfluxDB
InfluxData
 
How a Heat Treating Plant Ensures Tight Process Control and Exceptional Quali...
InfluxData
 
How Delft University's Engineering Students Make Their EV Formula-Style Race ...
InfluxData
 
Introducing InfluxDB’s New Time Series Database Storage Engine
InfluxData
 
Start Automating InfluxDB Deployments at the Edge with balena
InfluxData
 
Understanding InfluxDB’s New Storage Engine
InfluxData
 
Streamline and Scale Out Data Pipelines with Kubernetes, Telegraf, and InfluxDB
InfluxData
 
Ward Bowman [PTC] | ThingWorx Long-Term Data Storage with InfluxDB | InfluxDa...
InfluxData
 
Scott Anderson [InfluxData] | New & Upcoming Flux Features | InfluxDays 2022
InfluxData
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts | InfluxDays 2022
InfluxData
 
Steinkamp, Clifford [InfluxData] | Welcome to InfluxDays 2022 - Day 2 | Influ...
InfluxData
 
Steinkamp, Clifford [InfluxData] | Closing Thoughts Day 1 | InfluxDays 2022
InfluxData
 

Recently uploaded (20)

PDF
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
PPTX
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
PDF
Latest Scam Shocking the USA in 2025.pdf
onlinescamreport4
 
PDF
Slides: PDF Eco Economic Epochs for World Game (s) pdf
Steven McGee
 
PPTX
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
PPTX
Microsoft PowerPoint Student PPT slides.pptx
Garleys Putin
 
PPTX
Black Yellow Modern Minimalist Elegant Presentation.pptx
nothisispatrickduhh
 
PPTX
Different Generation Of Computers .pptx
divcoder9507
 
PPTX
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
PPTX
B2B_Ecommerce_Internship_Simranpreet.pptx
LipakshiJindal
 
PPTX
Slides Powerpoint: Eco Economic Epochs.pptx
Steven McGee
 
PPTX
AI ad its imp i military life read it ag
ShwetaBharti31
 
PPTX
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
APNIC
 
PPTX
dns domain name system history work.pptx
MUHAMMADKAVISHSHABAN
 
PDF
UI/UX Developer Guide: Tools, Trends, and Tips for 2025
Penguin peak
 
PDF
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
PDF
LOGENVIDAD DANNYFGRETRRTTRRRTRRRRRRRRR.pdf
juan456ytpro
 
PPTX
Unlocking Hope : How Crypto Recovery Services Can Reclaim Your Lost Funds
lionsgate network
 
PPTX
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
Latest Scam Shocking the USA in 2025.pdf
onlinescamreport4
 
Slides: PDF Eco Economic Epochs for World Game (s) pdf
Steven McGee
 
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
Microsoft PowerPoint Student PPT slides.pptx
Garleys Putin
 
Black Yellow Modern Minimalist Elegant Presentation.pptx
nothisispatrickduhh
 
Different Generation Of Computers .pptx
divcoder9507
 
办理方法西班牙假毕业证蒙德拉贡大学成绩单MULetter文凭样本
xxxihn4u
 
B2B_Ecommerce_Internship_Simranpreet.pptx
LipakshiJindal
 
Slides Powerpoint: Eco Economic Epochs.pptx
Steven McGee
 
AI ad its imp i military life read it ag
ShwetaBharti31
 
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
APNIC
 
dns domain name system history work.pptx
MUHAMMADKAVISHSHABAN
 
UI/UX Developer Guide: Tools, Trends, and Tips for 2025
Penguin peak
 
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
LOGENVIDAD DANNYFGRETRRTTRRRTRRRRRRRRR.pdf
juan456ytpro
 
Unlocking Hope : How Crypto Recovery Services Can Reclaim Your Lost Funds
lionsgate network
 
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 

OPTIMIZING THE TICK STACK

  • 2. Agenda: New Practitioners Track WORKSHOPAGENDA 8:00 AM – 9:00 AM Breakfast 9:00 AM – 10:00 AM Installing the TICK Stack and Your First Query Noah Crowley 10:00 AM – 10:50 AM Chronograf and Dashboarding David Simmons 10:50 AM – 11:20 AM Break 11:20 AM – 12:10 PM Writing Queries (InfluxQL and TICK) Noah Crowley 12:10 PM – 1:10 PM Lunch 1:10 PM – 2:00 PM Architecting InfluxEnterprise for Success Dean Sheehan 2:00 PM – 2:10 PM Break 2:10 PM – 3:00 PM Optimizing the TICK Stack Dean Sheehan 3:10 PM – 4:00 PM Downsampling Data Michael DeSa 4:00 PM Happy Hour
  • 3. Dean Sheehan Senior Director, Pre and Post Sales Optimizing the TICK Stack • What shape is your data? • Ingest optimization • Query considerations • Offloading stream processing
  • 5. The Line Protocol • Self describing data – Points are written to InfluxDB using the Line Protocol, which follows the following format: <measurement>[,<tag-key>=<tag-value>] [<field-key>=<field-value>] [unix-nano-timestamp] – This provides extremely high flexibility as new metrics are identified for collection into InfluxDB. New measure to capture? Just send it to InfluxDB. It’s that easy. cpu_load,hostname=server02,az=us_west usage_user=24.5,usage_idle=15.3 1234567890000000 Measurement Tag Set Field Set Timestamp
  • 6. DON'T ENCODE DATA INTO THE MEASUREMENT NAME • Measurement names like: • Encode that information as tags: cpu.server-5.us-west value=2 1444234982000000000 cpu.server-6.us-west value=4 1444234982000000000 mem-free.server-6.us-west value=2500 1444234982000000000 cpu,host=server-5,region=us-west value=2 1444234982000000000 cpu,host=server-6,region=us-west value=4 1444234982000000000 mem-free,host=server-6,region=us-west value=2500 1444234982000000
  • 7. What if my plugin sends data like that to InfluxDB? Write something that sits between your plugin and InfluxDB to sanitize the data OR use one of our write plugins: Example - Telegraf’s Graphite input plugin: Takes input like… …and parses it with the following template… …resulting in the following points in line protocol hitting the database: sensu.metric.net.server0.eth0.rx_packets 461295119435 1444234982 sensu.metric.net.server0.eth0.tx_bytes 1093086493388480 1444234982 sensu.metric.net.server0.eth0.rx_bytes 1015633926034834 1444234982 ["sensu.metric.* ..measurement.host.interface.field"] net,host=server0,interface=eth0 rx_packets=461295119435 1444234982 net,host=server0,interface=eth0 tx_bytes=1093086493388480 1444234982 net,host=server0,interface=eth0 rx_bytes=1015633926034834 1444234982
  • 8. Things to remember ● Tags are Indexed ● Fields are not ● All points are indexed by time
  • 9. DON’T OVERLOAD TAGS • BAD • GOOD: Separate out into different tags: cpu,server=localhost.us-west value=2 1444234982000000000 cpu,server=localhost.us-east value=3 1444234982000000000 cpu,host=localhost,region=us-west value=2 1444234982000000000 cpu,host=localhost,region=us-east value=3 1444234982000000000
  • 10. DON’T USE THE SAME NAME FOR A FIELD AND A TAG • BAD: This significantly complicates queries. • GOOD: Differentiate the names somehow: login,user=admin user=2342,success=1 1444234982000 SELECT user::field, user::tag FROM login login,role=admin user=2342,success=1 1444234982000
  • 11. DON'T USE TOO FEW TAGS • BAD • Problems you might run into: • Fields are not indexed, so queries with field conditions have to scan every point. • GROUP BY <field> is not valid, you can only GROUPBY <tag> cpu,region=us-west host="server1",value=4,temp=2 1444234982000 cpu,region=us-west host="server2",value=1,other=14 1444234982000
  • 12. DON'T CREATE TOO MANY LOGICAL CONTAINERS Or rather, don’t write to too many databases: • Dozens of databases should be fine • hundreds might be okay • thousands probably aren't without careful design Too many databases leads to more open files, more query iterators in RAM, and more shards expiring. Expiring shards have a non-trivial RAM and CPU cost to clean up the indices. OR MEASURMENTS
  • 13. The Last Writes Wins! • InfluxDB only stores one value for a given series • ‘Given’ series meaning what? – {Measurment,TagSet,Timestamp} • If you send in another entry for same {M,TS,T} – Result is union of previous and new field values
  • 15. Internet Of Things – City Air Quality • There are 10k sensor units that measure • Smog, Carbon Dioxide, Lead and Sulfur Dioxide • at different locations throughout a city • Sensor units send measurements to Influx every 10 seconds • IOT people like to think in Hertz, that would be 0.1Hz
  • 16. Sensor data • zip_code Zipcode of the sensor location city Name of the city lat Latitude of the sensor lng Longitude of the sensor device_id UUID of the device smog_level Smog level measurement co2_ppm CO2 parts per million measurement lead Atmospheric lead level measurement so2_level Sulfur Dioxide level measurement
  • 17. Exercise Why would it be a bad idea to make lat or lng a tag instead of a field?
  • 18. Solution • Why would it be a bad idea to make lat or lng a tag instead of a field? – Numeric Property: We probably care about doing math on lat and lng. That can only work if they are fields.
  • 19. Exercise Why would it be a good idea to make lat or lng a tag instead of a field?
  • 20. Solution • Why would it be a good idea to make lat or lng a tag instead of a field? – We probably care about filtering or grouping by lat and lng. Filters are faster with tags, and only tags are valid for grouping. – If our devices don't move, lat and lng are dependent tags on device_id. Storing them as tags won't increase series cardinality. • Keep in mind that you can’t do any of the numeric computations on tags
  • 21. The following queries are important SELECT median(lead) FROM pollutants WHERE time > now() - 1d GROUP BY city SELECT mean(co2_ppm) FROM pollutants WHERE time > now() - 1d AND city='sf' GROUP BY device_id SELECT max(smog_level) FROM pollutants WHERE time > now() - 1d AND city='nyc' GROUP BY zipcode SELECT min(so2_level) FROM pollutants WHERE time > now() - 1d AND city='nyc' GROUP BY zipcode
  • 22. Question How can we organize our data to support the queries that we want?
  • 23. Schema 1 for Pollutants measurement: pollutants tags: city device_id zipcode fields: lat lng smog_level co2_ppm lead so2_level Examples in Line Protocol pollutants, city=richmond,device_id=12,zipcode=23221 lat=37.5333,lng=77.4667,smog_level=2.4,co2_ppm=404i,lead=2.3,so2_level=3i 142309324834700 pollutants, city=bozeman,device_id=37,zipcode=59715 lat=45.6778,lng=111.0472,smog_level=0.9,co2_ppm=398i,lead=1.3,so2_level=1i 142309324834700
  • 24. Schema 2 for Pollutants measurement: pollutants tags: lat lng city device_id zipcode fields: smog_level co2_ppm lead so2_level Examples in Line Protocol pollutants, city=richmond,device_id=12,zipcode=23221,lat=37.5333,lng=77.4667 smog_level=2.4,co2_ppm=404i,lead=2.3,so2_level=3i 142309324834700 pollutants, city=bozeman,device_id=37,zipcode=59715,lat=45.6778,lng=111.0472 smog_level=0.9,co2_ppm=398i,lead=1.3,so2_level=1i 142309324834700
  • 25. Queries and data on disk • Shards have a duration • Queries that touch more shards run slower • Look to configure a shard duration that means queries are typically answered from few (1) shards • We recommend configuring the shard group duration such that: – It is two times your longest typical query’s time range – Each shard group has at least 100,000 points – Each shard group has at least 1,000 points per series
  • 26. Time Series Index • You have a choice – Inmemory index – Memory mapped (to disk) index – Time Series Index • Inmemory Index has limits – How much memory do you have? – Needs rebuild on restart • Time Series Index uses disk – Little slower in some situations – Upside is how much disk do you have compared to memory (and restart speed)
  • 27. Optimizing ingestion • Batch your writes if possible – Something like 5000 points per batch • Be mindful of thundering heard – Boat load of data from hundreds of sources at same second – Jitter
  • 28. Aggregate inputs Telegraf Telegraf TelegrafTelegraf Telegraf Telegraf Telegraf TelegrafTelegraf Telegraf Telegraf Telegraf TelegrafTelegraf Telegraf Telegraf TelegrafTelegraf
  • 29. Query considerations • Time bound – We’re a time series database after all • Query large, return small – Human consumers don’t work well with large amounts of data – Machine consumers – maybe but the more you can ask InfluxDB to do the better • Use tags – Comes back to thinking about your schema early on • Can’t win them all
  • 30. Offload stream processing • You can clearly run queries periodically to look for worrying situations – And generate alarms in your calling code • Be respectful of the DB engine, it is working hard to store your data and answer important queries • Some ‘queries’ might be better handled by observing and operating on the stream of data InfluxDB sees • Kapacitor ‘subscribes’ to InfluxDB
  • 31. Other pearls • Query limit configuration • max-concurrent-queries • max-select-point • max-select-series • Queries • Reminder time-series queries - should always include time • Backfilling data • Insert data ordered by timestamp/tags - newest to oldest