Time series databases

It all starts with the need to collect, store, and query measurements over time. When dealing with massive amounts of data from collectors and sensors (such as those that make up the Internet of Things), querying the resulting datasets is extremely slow if the database isn't designed with that use case in mind. Nothing prevents you from using standard relational or NoSQL databases to store time series data, but the performance penalty and scalability concerns should make you ponder on that decision. Prometheus chose to implement a time series database that was tailored to its unique problem space.

Besides the write-heavy aspect of these types of databases, which in turn implies the storage of a massive volume of measurements, it is also important to understand that a simple query can span over several hours, days, or even months, returning a tremendous amount of data points, but is still expected to return data reasonably fast.

As such, modern time series databases store the following components:

  • A timestamp
  • A value
  • Some context about the value, encoded in a metric name or in associated key/value pairs

An abstract example of data that fits this time series database specification is as follows:

timestamp=1544978108, company=ACME, location=headquarters, beverage=coffee, value=40172

As you can see, this kind of data can be easily stored into a single table in a database:

timestamp company location beverage value
1544978108 ACME headquarters coffee 40172

In this simple example, we can check the cups of coffee being served by a vending machine located at the headquarters of the ACME company. This example has all the required components of a time series if it's continually measured through time.

This example does not map directly to the Prometheus data model, as it also requires a metric name, but illustrates the logic we're aiming to address.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.126.241