Course contentsShow
← System Design
Lesson 1202 of 1,91930. Observability: MetricsFree lesson

Graphite Time-Series Database

Learn Graphite's architecture, hierarchical metric naming, storage engine, and retention policies for metrics data.

Graphite Time-Series Database

What you'll learn: How Graphite stores, organizes, and retrieves time-series metrics data at scale.

What is Graphite?

Graphite is one of the oldest and most mature time-series databases designed specifically for storing numeric metrics over time. Unlike Prometheus (which pulls metrics), Graphite is built around a push model where applications send metrics to it. It excels at storing historical data with configurable retention policies, making it ideal for long-term trend analysis.

Core Architecture

Graphite consists of three main components:

  • Carbon: The listener daemon that receives metrics over the network (typically via plaintext protocol or pickle)
  • Whisper: The fixed-size database format that stores time-series data on disk
  • Graphite-web: The web application for querying and rendering graphs

Hierarchical Metric Naming

Graphite uses a dot-separated hierarchical namespace for organizing metrics:

servers.web01.cpu.usage
servers.web01.memory.used
servers.web02.cpu.usage

This tree-like structure lets you query patterns like servers.*.cpu.usage to aggregate across all servers. Think of it like a file system path where you can wildcard directories.

Storage Engine and Retention Policies

Whisper databases are fixed-size files that implement a circular buffer. You define retention policies upfront, for example:

  • Keep 10-second resolution for 6 hours
  • Keep 1-minute resolution for 7 days
  • Keep 10-minute resolution for 1 year

Older high-resolution data automatically rolls up into lower-resolution averages, saving space while preserving long-term trends. Once a Whisper file is created, its size never changes—it just overwrites the oldest data.

Key Takeaway: Graphite uses a hierarchical naming scheme and fixed-size Whisper databases with configurable retention tiers to efficiently store time-series metrics with predictable storage costs.