This is the third in a series of detailed benchmarking tests comparing InfluxDB vs Elasticsearch, Cassandra, MongoDB and other databases for time-series data and metrics workloads.
At InfluxData, one of the common questions we’ve been getting asked by developers and architects alike the last few months is, “How does InfluxDB compare to MongoDB for time-series workloads?” This question might be prompted for a few reasons. First, if they’re starting a brand new project and doing the due diligence of evaluating a few solutions head-to-head, it can be helpful in creating their comparison grid. Second, they might already be using MongoDB for ingesting data in an existing application, but would like to now see how they can integrate metrics collection into their system and believe there might be a better solution than MongoDB for this task.
Over the last few weeks a few members of the InfluxData engineering and QA teams set out to compare the performance and features of InfluxDB and MongoDB for common time-series workloads, specifically looking at the rates of data ingestion, on-disk data compression, and query performance. InfluxDB outperformed MongoDB in all three tests with 27x greater write throughput, while using 84x less disk space, and delivering relatively equal performance when it came to query speed.
To read the complete details of the benchmarks and methodology, download the “Benchmarking InfluxDB vs. MongoDB for Time-Series Data & Metrics Management” technical paper.
Our overriding goal was to create a consistent, up-to-date comparison that reflects the latest developments in both InfluxDB and MongoDB with later coverage of other databases and time-series solutions. We will periodically re-run these benchmarks and update our detailed technical paper with our findings. All of the code for these benchmarks are available on Github. Feel free to open up issues or pull requests on that repository or if you have any questions, comments, or suggestions.
Now, let’s take a look at the results…
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.
About the Benchmarks
In building a representative benchmark suite, we identified the most commonly evaluated characteristics for working with time-series data. We looked at performance across three vectors:
- Data ingest performance – measured in values per second
- On-disk storage requirements – measured in MBs
- Mean query response time – measured in milliseconds
About the Dataset
For this benchmark, we focused on a dataset that models a common DevOps monitoring and metrics use case, where a fleet of servers are periodically reporting system and application metrics at a regular time interval. We sampled 100 values across 9 subsystems (CPU, memory, disk, disk I/O, kernel, network, Redis, PostgreSQL, and Nginx) every 10 seconds. For the key comparisons, we looked at a dataset that represents 100 servers over a 6-hour period, which represents a relatively modest deployment.
- Number of Servers: 1000
- Values measured per Server: 100
- Measurement Interval: 10s
- Dataset duration(s): 6h
- Total values in dataset: 216,000,000
This is only a subset of the entire benchmark suite, but it’s a representative example. If you’re interested in additional detail, you can read more about the testing methodology on GitHub.
InfluxDB outperformed MongoDB by 27x when it came to data ingestion.
InfluxDB outperformed MongoDB by delivering 84x better compression.
InfluxDB and MongoDB had relatively equal performance characteristics when it came to query speed.
The benchmarking tests and resulting data demonstrated that InfluxDB outperformed MongoDB in data ingestion and on-disk storage by a significant margin. Specifically:
- InfluxDB outperformed MongoDB by 27x when it came to data ingestion
- InfluxDB outperformed MongoDB by delivering 84x better compression
- InfluxDB and MongoDB performed similarly on query response time as concurrency increased.
It’s also important to note that configuring MongoDB to work with time series data wasn’t trivial. It requires up-front decisions about how to structure your collections and data types, which can be very time consuming and will have long-lasting impacts on how you can interact with your data and what types of queries you can run. InfluxDB, on the other hand, is ready to use for time series workloads out-of-the-box with no additional configuration.
In conclusion, we highly encourage developers and architects to run these benchmarks themselves to independently verify the results on their hardware and data sets of choice. However, for those looking for a valid starting point on which technology will give better time-series data ingestion, compression and query performance “out-of-the-box”, InfluxDB is the clear winner across many dimensions, especially when the data sets become larger and the system runs over a longer period of time.
- Download: 1.0 GA downloads for the TICK-stack are live on our “downloads” page
- Deploy on the Cloud: Get started with a FREE trial of InfluxCloud featuring fully-managed clusters, Kapacitor and Grafana.
- Deploy on Your Servers: Want to run InfluxDB clusters on your servers? Try a FREE 14-day trial of InfluxEnterprise featuring an intuitive UI for deploying, monitoring and rebalancing clusters, plus managing backups and restores.
- Tell Your Story: Over 100 companies have shared their story on how InfluxDB is helping them succeed. Submit your testimonial and get a limited edition InfluxDB hoodie as a thank you.