Introduction to Graphite

What is graphite




Graphite provides real-time visualization and storage of numeric time-series data

Graphite does two things:

  1. Graphite stores numeric time-series data.
  2. Graphite renders graphs of this data on demand.

Graphite consits of 3 parts

  1. carbon - a daemon that listens for time-series data
  2. whisper - a simple database library for storing time-series data
  3. webapp - a (Django) webapp that renders graphs on demand

Carbon



Python twisted daemons that listens for time-series data

  • carbon-cache.py
  • carbon-relay.py
  • carbon-aggrefator.py
  • megacarbon?

CARBON-CACHE.PY

  • carbon-cache.py  
    • accepts metrics over various protocols and writes them to disk as efficiently as possible
    • caches metric values in RAM as they are received
    • flushes them to disk on an interval using the underlying whisper library
  • carbon.conf
    • [cache] section
  • storage-schemas.conf
    • Defines a retention policy for metrics based on regex patterns
    • This policy is passed to whisper when .wsp file is pre-allocated,and dictates how long data is stored for.


carbon-replay.py

To scale out, simple run multiple carbon-cache.py instances bebind a carbon-aggregator.py or carbon-replay.py

  • For replication and sharding
  • RELAY_METHOD = rules |  consistent-hashing
  • carbon.conf
    • [replay] section   (REPLAY_METHOD)
  • relay-rules.conf
    • REPLAY_METHOD = rules, pattern/servers tuples define what servers metrics matching certain regex rules are forwarded to 


carbon-aggregator.py

Buffer and Aggregator in front of carbon-cache.py


Whisper Libary

A simple database libaray for storing time-series data (like RRD)

THE FORMAT OF TIME-SERIES DATA


<key> <numric value> <timestamp>

STORAGE SCHEMAS

Graphite matches data paths with a pattern and tells what frequency and history for our data to store

The retention format is  frequency:history

[stats]
pattern = ^stats\..*
retentions = 1m:7d,15m:120d