Choosing the right database is a critical choice when building any software application. All databases have different strengths and weaknesses when it comes to performance, so deciding which database has the most benefits and the most minor downsides for your specific use case and data model is an important decision. Below you will find an overview of the key concepts, architecture, features, use cases, and pricing models of M3 and Prometheus so you can quickly see how they compare against each other.

The primary purpose of this article is to compare how M3 and Prometheus perform for workloads involving time series data, not for all possible use cases. Time series data typically presents a unique challenge in terms of database performance. This is due to the high volume of data being written and the query patterns to access that data. This article doesn’t intend to make the case for which database is better; it simply provides an overview of each database so you can make an informed decision.

M3 vs Prometheus Breakdown


 
Database Model

Time series database

Time series database

Architecture

The M3 stack can be deployed on-premises or in the cloud, using containerization technologies like Kubernetes or as a managed service on platforms like AWS or GCP

Prometheus uses a pull-based model where it scrapes metrics from configured targets at given intervals. It stores time series data in a custom, efficient, local storage format, and supports multi-dimensional data collection, querying, and alerting. It can be deployed as a single binary on a server or on a container platform like Kubernetes.

License

Apache 2.0

Apache 2.0

Use Cases

Monitoring, observability, IoT, Real-time analytics, large-scale metrics processing

Monitoring, alerting, observability, system metrics, application metrics

Scalability

Horizontally scalable, designed for high availability and large-scale deployments

Prometheus is designed for reliability and can scale vertically (single node with increased resources) or through federation (hierarchical setup where Prometheus servers scrape metrics from other Prometheus servers)

M3 Overview

M3 is a distributed time series database written entirely in Go. It is designed to collect a high volume of monitoring time series data, distribute storage in a horizontally scalable manner, and efficiently leverage hardware resources. M3 was initially developed by Uber as a scalable remote storage backend for Prometheus and Graphite and later open-sourced for broader use.

Prometheus Overview

Prometheus is an open-source monitoring and alerting toolkit initially developed at SoundCloud in 2012. It has since become a widely adopted monitoring solution and a part of the Cloud Native Computing Foundation (CNCF) project. Prometheus focuses on providing real-time insights and alerts for containerized and microservices-based environments. Its primary use case is monitoring infrastructure and applications, with an emphasis on reliability and scalability.


M3 for Time Series Data

M3 is specifically designed for time-series data. It is a distributed and scalable time-series database optimized for handling large volumes of high-resolution data points, making it an ideal solution for storing, querying, and analyzing time-series data.

M3’s architecture focuses on providing fast and efficient querying capabilities, as well as high ingestion rates, which are essential for working with time-series data. Its horizontal scalability and high availability ensure that it can handle the demands of large-scale deployments and maintain performance as data volumes grow.

Prometheus for Time Series Data

Prometheus is specifically designed for time series data, as its primary focus is on monitoring and alerting based on the state of infrastructure and applications. It uses a pull-based model, where the Prometheus server scrapes metrics from the target systems at regular intervals. This model is suitable for monitoring dynamic environments, as it allows for automatic discovery and monitoring of new instances. However, Prometheus is not intended as a general-purpose time series database and might not be the best choice for high cardinality or long-term data storage.


M3 Key Concepts

  • Time Series Compression: M3 has the ability to compress time series data, resulting in significant memory and disk savings. It uses two compression algorithms, M3TSZ and protobuf encoding, to achieve efficient data compression.
  • Sharding: M3 uses virtual shards that are assigned to physical nodes. Timeseries keys are hashed to a fixed set of virtual shards, making horizontal scaling and node management seamless.
  • Consistency Levels: M3 provides variable consistency levels for read and write operations, as well as cluster connection operations. Write consistency levels include One (success of a single node), Majority (success of the majority of nodes), and All (success of all nodes). Read consistency level is One, which corresponds to reading from a single nod

Prometheus Key Concepts

  • Metric: A numeric representation of a particular aspect of a system, such as CPU usage or memory consumption.
  • Time Series: A collection of data points for a metric, indexed by timestamp.
  • Label: A key-value pair that provides metadata and context for a metric, enabling more granular querying and aggregation.
  • PromQL: Prometheus uses its own query language called PromQL (Prometheus Query Language) for querying time series data and generating alerts.


M3 Architecture

M3 is designed to be horizontally scalable and handle high data throughput. It uses fileset files as the primary unit of long-term storage, storing compressed streams of time series values. These files are flushed to disk after a block time window becomes unreachable. M3 has a commit log, equivalent to the commit log or write-ahead-log in other databases, which ensures data integrity. Client Peer streaming is responsible for fetching blocks from peers for bootstrapping purposes. M3 also implements caching policies to optimize efficient reads by determining which flushed blocks are kept in memory.

Prometheus Architecture

Prometheus is a single-server, standalone monitoring system that uses a pull-based approach to collect metrics from target systems. It stores time series data in a custom, highly compressed, on-disk format, optimized for fast querying and low resource usage. The architecture of Prometheus is modular and extensible, with components like exporters, service discovery mechanisms, and integrations with other monitoring systems. As a non-distributed system, it lacks built-in clustering or horizontal scalability, but it supports federation, allowing multiple Prometheus servers to share and aggregate data.

Free Time-Series Database Guide

Get a comprehensive review of alternatives and critical requirements for selecting yours.

M3 Features

Commit Log

M3 uses a commit log to ensure data integrity, providing durability for write operations.

Peer Streaming

M3’s client peer streaming fetches data blocks from peers for bootstrapping purposes, optimizing data retrieval and distribution.

Caching Mechanisms

M3 implements various caching policies to efficiently manage memory usage, keeping frequently accessed data blocks in memory for faster reads.

Prometheus Features

Pull-based Model

Prometheus collects metrics by actively scraping targets, enabling automatic discovery and monitoring of dynamic environments.

PromQL

The powerful Prometheus Query Language allows for expressive and flexible querying of time series data.

Alerting

Prometheus supports alerting based on user-defined rules and integrates with various alert management and notification systems.


M3 Use Cases

Monitoring and Observability

M3 is particularly suitable for large-scale monitoring and observability tasks, as it can store and manage massive volumes of time-series data generated by infrastructure, applications, and microservices. Organizations can use M3 to analyze, visualize, and detect anomalies in the metrics collected from various sources, enabling them to identify potential issues and optimize their systems.

IoT and Sensor Data

M3 can be used to store and process the vast amounts of time-series data generated by IoT devices and sensors. By handling data from millions of devices and sensors, M3 can provide organizations with valuable insights into the performance, usage patterns, and potential issues of their connected devices. This information can be used for optimization, predictive maintenance, and improving the overall efficiency of IoT systems.

Financial Data Analysis

Financial organizations can use M3 to store and analyze time-series data related to stocks, bonds, commodities, and other financial instruments. By providing fast and efficient querying capabilities, M3 can help analysts and traders make more informed decisions based on historical trends, current market conditions, and potential future developments.

Prometheus Use Cases

Infrastructure Monitoring

Prometheus is widely used for monitoring the health and performance of containerized and microservices-based infrastructure, including Kubernetes and Docker environments.

Application Performance Monitoring (APM)

Prometheus can collect custom application metrics using client libraries and monitor application performance in real-time.

Alerting and Anomaly Detection

Prometheus enables organizations to set up alerts based on specific thresholds or conditions, helping them identify and respond to potential issues or anomalies quickly.


M3 Pricing Model

M3 is an open source database and can be used freely, although you will have to account for the cost of managing your infrastructure and the hardware used to run M3. Chronosphere is the co-maintainer of M3 along with Uber and also offers a hosted observability that uses M3 as the backend storage layer.

Prometheus Pricing Model

Prometheus is an open-source project, and there are no licensing fees associated with its use. However, costs can arise from hardware, hosting, and operational expenses when deploying a self-managed Prometheus server. Additionally, several cloud-based managed Prometheus services, such as Grafana Cloud and Weave Cloud, offer different pricing models based on factors like data retention, query rate, and support.

Get started with InfluxDB for free

InfluxDB Cloud is the fastest way to start storing and analyzing your time series data.