Why time series databases matter - InfluxDB vs MongoDB
In this technical paper, we’ll compare the performance and features of InfluxDB vs MongoDB for common time series workloads, specifically looking at the rates of data ingestion, on-disk data compression, and query performance.
InfluxDB is an open source time series database written in Go. At its core is a custom-built storage engine called the Time-Structured Merge (TSM) Tree, which is optimized for time series data. Controlled by a custom SQL-like query language named InfluxQL, InfluxDB provides out-of-the-box support for mathematical and statistical functions across time ranges and is perfect for custom monitoring and metrics collection, real-time analytics, plus IoT and sensor data workloads.
MongoDB is an open-source, document-oriented database, colloquially known as a NoSQL database, written in C and C++. Though it’s not generally considered a true time series database per se, its creators often promote its use for time series workloads. It offers modeling primitives in the form of timestamps and bucketing, which give users the ability to store and query time series data. Please note that this paper does not look at the suitability of InfluxDB for workloads other than those that are time series-based. InfluxDB is not designed to satisfy document storage use cases and therefore those will not be explored in this paper. For these use cases, we recommend sticking with MongoDB or similar NoSQL databases.
This data should prove valuable to developers and architects evaluating the suitability of these technologies for their use case. Specifically, the time series data management use cases involving building DevOps monitoring (infrastructure monitoring, application monitoring, cloud monitoring), IoT monitoring, and real-time analytics applications.
Our goal with this benchmarking test was to create a consistent, up-to-date comparison that reflects the latest developments in both InfluxDB and MongoDB. Periodically, we’ll re-run these benchmarks and update this document with our findings. All of the code for these benchmarks is available on GitHub. Feel free to open up issues or pull requests on that repository or if you have any questions, comments, or suggestions.