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 AWS DynamoDB and M3 so you can quickly see how they compare against each other.
The primary purpose of this article is to compare how AWS DynamoDB and M3 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.
AWS DynamoDB vs M3 Breakdown
Key-value and document store
Time series database
DynamoDB is a fully managed, serverless NoSQL database provided by Amazon Web Services (AWS). It uses a single-digit millisecond latency for high-performance use cases and supports both key-value and document data models. Data is partitioned and replicated across multiple availability zones within an AWS region, and DynamoDB supports eventual or strong consistency for read operations
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
Serverless web applications, real-time bidding platforms, gaming leaderboards, IoT data management, high-velocity data processing
Monitoring, observability, IoT, Real-time analytics, large-scale metrics processing
Automatically scales to handle large amounts of read and write throughput, supports on-demand capacity and auto-scaling, global tables for multi-region replication
Horizontally scalable, designed for high availability and large-scale deployments
AWS DynamoDB Overview
Amazon DynamoDB is a managed NoSQL database service provided by AWS. It was first introduced in 2012, and it was designed to provide low-latency, high-throughput performance. DynamoDB is built on the principles of the Dynamo paper, which was published by Amazon engineers in 2007, and it aims to offer a highly available, scalable, and distributed key-value store.
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.
AWS DynamoDB for Time Series Data
DynamoDB can be used with time series data, although it may not be the most optimized solution compared to specialized time series databases. To store time series data in DynamoDB, you can use a composite primary key with a partition key for the entity identifier and a sort key for the timestamp. This allows you to efficiently query data for a specific entity and time range. However, DynamoDB’s main weakness when dealing with time series data is its lack of built-in support for data aggregation and downsampling, which are common requirements for time series analysis. You may need to perform these operations in your application or use additional services like AWS Lambda to process the data.
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.
AWS DynamoDB Key Concepts
Some of the key terms and concepts specific to DynamoDB include:
- Tables: In DynamoDB, data is stored in tables, which are containers for items. Each table has a primary key that uniquely identifies each item in the table.
- Items: Items are individual records in a DynamoDB table, and they consist of one or more attributes.
- Attributes: Attributes are key-value pairs that make up an item in a table. DynamoDB supports scalar, document, and set data types for attributes.
- Primary Key: The primary key uniquely identifies each item in a table, and it can be either a single-attribute partition key or a composite partition-sort key.
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
AWS DynamoDB Architecture
DynamoDB is a NoSQL database that uses a key-value store and document data model. It is designed to provide high availability, durability, and scalability by automatically partitioning data across multiple servers and using replication to ensure fault tolerance. Some of the main components of DynamoDB include:
- Partitioning: DynamoDB automatically partitions data based on the partition key, which ensures that data is evenly distributed across multiple storage nodes.
- Replication: DynamoDB replicates data across multiple availability zones within an AWS region, providing high availability and durability.
- Consistency: DynamoDB offers two consistency models: eventual consistency and strong consistency, allowing you to choose the appropriate level of consistency for your application.
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.
Free Time-Series Database Guide
Get a comprehensive review of alternatives and critical requirements for selecting yours.
AWS DynamoDB Features
DynamoDB can automatically scale its read and write capacity based on the workload, allowing you to maintain consistent performance without over-provisioning resources.
Backup and restore
DynamoDB provides built-in support for point-in-time recovery, enabling you to restore your table to a previous state within the last 35 days.
DynamoDB global tables enable you to replicate your table across multiple AWS regions, providing low-latency access and data redundancy for global applications.
DynamoDB Streams capture item-level modifications in your table and can be used to trigger AWS Lambda functions for real-time processing or to synchronize data with other AWS services.
M3 uses a commit log to ensure data integrity, providing durability for write operations.
M3’s client peer streaming fetches data blocks from peers for bootstrapping purposes, optimizing data retrieval and distribution.
M3 implements various caching policies to efficiently manage memory usage, keeping frequently accessed data blocks in memory for faster reads.
AWS DynamoDB Use Cases
DynamoDB can be used to store session data for web applications, providing fast and scalable access to session information.
DynamoDB can be used to store player data, game state, and other game-related information for online games, providing low-latency and high-throughput performance.
Internet of Things
DynamoDB can be used to store and process sensor data from IoT devices, enabling real-time monitoring and analysis of device data.
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.
AWS DynamoDB Pricing Model
DynamoDB offers two pricing options: provisioned capacity and on-demand capacity. With provisioned capacity, you specify the number of reads and writes per second that you expect your application to require, and you are charged based on the amount of provisioned capacity. This pricing model is suitable for applications with predictable traffic or gradually ramping traffic. You can use auto scaling to adjust your table’s capacity automatically based on the specified utilization rate, ensuring application performance while reducing costs.
On the other hand, with on-demand capacity, you pay per request for the data reads and writes your application performs on your tables. You do not need to specify how much read and write throughput you expect your application to perform, as DynamoDB instantly accommodates your workloads as they ramp up or down. This pricing model is suitable for applications with fluctuating or unpredictable traffic patterns.
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.
Get started with InfluxDB for free
InfluxDB Cloud is the fastest way to start storing and analyzing your time series data.