kenju's blog

About Programming and Mathematics

TICKStack, InfluxDB and InfluxData's Design Architecture & Key Concepts Notes

I am considering to put gRPC load testing metrics into InfluxDB, and visualize with Grafana. That drives me to have strong interests in the background architecture & its design key concepts of InfluxDB, and TICK Stack.

This blog post is my researching notes for InfluxDB and TICK Stacks.

TICK Stack

InfluxDB is one of a stack of TICK Stack, which is developed as a OSS product by InfluxData.

Key Concepts

The official docs describes the basic key concepts for understanding InfluxDB:

  • timestamp
    • all data have time columns
    • RFC3339 UTC
  • tag set
    • optional
    • any key-value pairs
  • retention policy
    • how long InfluxDB keeps data (DURATION)
    • how many copies of those data are stored in the cluster (REPLICATION)
  • point
    • the field set in the same series with the same timestamp

InfluxDB Line Protocol

InfluxDB Line Protocol is a line log which looks like below:

weather,location=us-midwest temperature=82 1465839830100400200
  |    -------------------- --------------  |
  |             |             |             |
  |             |             |             |
+-----------+--------+-+---------+-+---------+
|measurement|,tag_set| |field_set| |timestamp|
+-----------+--------+-+---------+-+---------+
  • whitespaces are separator of each components
  • support floats, integers, string or booleans as field values type
  • use HTTP API with curl or CLI to write to InfluxDB with Line Protocol

Run Locally

You can use docker image for local development:

docker run \
  --name=influxdb \
  -d \
  -p 8086:8086 \
  -p 8083:8083 \
  -e INFLUXDB_ADMIN_ENABLED=true \
  influxdb:1.6

And then, run below to connect to the InfluxDB container:

docker exec -it influxdb bash
influx -precision rfc3339

Open GUI like this (only with darwin):

open http://localhost:8083

Implementation

Here is the repository of influxdb:

https://github.com/influxdata/influxdb

  • written in Golang
    • can be compiled into a single binary to run on many platforms

Query (InfluxQL)

Influx Query Language specification is described at https://docs.influxdata.com/influxdb/v1.6/query_language/ .

InfluxQL is similar to SQL, but support much more time-series oriented queries & features.

InfluxQL function supports:

  • Aggregations
    • e.g. COUNT(), MEAN(), SUM()
  • Selectors
    • e.g. MAX(), MIN(), SAMPLE()
  • Transformations
    • e.g. ABS(), CEIL(), LOG(), POW(), SIN()
  • Predictors
    • HOLT_WINTERS()
  • Technical Analysis
    • e.g. EXPONENTIAL_MOVING_AVERAGE()