OpenTSDB

OpenTSDB is a distributed, scalable Time Series Database (TSDB) written on top of HBase. OpenTSDB was written to address a common need: store, index, and serve metrics collected from computer systems (network gear, operating systems, applications) at a large scale, and make this data easily accessible and graphable. OpenTSDB is the first open-source monitoring system built on an open-source distributed database.

OpenTSDB is written in Java because HBase, its embedding storage model, is written in Java.

History

OpenTSDB was originally written by Benoit Sigoure in 2010 to monitor metrics of the StumbleUpon search engine which requires storing over 1 billion data points per day. StumbleUpon was in charge of the initial development and its open-source release. Yahoo! is currently maintaining OpenTSDB along with the open-source community.

Storage Model

N-ary Storage Model (Row/Record)

OpenTSDB has a N-ary storage model, each row is of the format Metrics, Tags, Timestamp: data1 : data2: ....

Concurrency Control

Timestamp Ordering

OpenTSDB allows concurrent writes without using locks. OpenTSDB avoids multiple writers creating duplicate rows in the case of writer restart by making writes idempotent. It enforces a fixed timestamp boundary for each row. When a write reconnects to HBase, it will always write to the appropriate row according to the timestamp instead of creating new rows.

Data Model

Key/Value

Data are stored as time series. Each time series is a collection of data points. A data point is a key-value map (time, value). A time series is identified by its metrics and tags. For example, Metrics=proc.loadaverage.1m, Tags=(host: web42, pool: static) is a collection of data points identifying the 1-minute load average of server web42 serving static contents.

Query Interface

Custom API HTTP / REST Command-line / Shell

There are 2 official supported query interfaces: HTTP/REST API and Telnet style command line API. Additionally, there are various open-source front-end clients that encapsulate the official APIs, including a Browser interface and Erlang/Java/Go/Python/R/Ruby clients.

System Architecture

Shared-Disk

OpenTSDB consists of three components: tCollector, Time Series Daemon (TSD), and HBase. One instance of tCollector is deployed on each server. It is responsible to periodically pull metrics data from processes running on the server and its operating system. TSDs receive data from the tCollectors and push data to the HBase backend storage system. Upon receiving queries, TSD scans HBase and retrieves relevant data.

All communications are done via TSD RPC and Hadoop RPC, therefore all components are stateless. There can be as many TSDs to handle the workload as the system scales.

Storage Architecture

Disk-oriented

The back-end storage system is HBase, an open-source non-relational disk-oriented distributed database.

Parallel Execution

Intra-Operator (Horizontal)

OpenTSDB supports running multiple TSDs to handle a single query, allowing parallel read from HBase to speed up data fetching.