Time-series databases (TSDBs) play a critical role in handling and analyzing time-stamped data efficiently.
In this article, we'll dive into the world of time-series databases by benchmarking two popular options: InfluxDB and VictoriaMetrics.
By comparing their performance, scalability, and features, we aim to help you make an informed choice when it comes to managing your time-series data.
InfluxDB is a widely recognized open-source time-series database known for its ease of use and versatility. It's designed to handle high write and query loads efficiently, making it a popular choice for DevOps, IoT, and monitoring applications.
Key features of InfluxDB include:
- SQL-like query language (InfluxQL).
- Built-in Grafana integration.
- Data retention policies for data aging.
- Continuous queries for data aggregation.
- Active open-source community.
VictoriaMetrics is another open-source time-series database, but it stands out with its focus on high performance and resource efficiency.
It's designed to handle vast amounts of time-series data while keeping hardware requirements low, making it an excellent choice for large-scale deployments.
Key features of VictoriaMetrics include:
- High ingestion rates and query performance.
- Long-term data retention without significant resource overhead.
- Efficient storage using a custom time-series database format.
- Support for PromQL, a powerful query language.
- Excellent compatibility with the Prometheus ecosystem.
To compare InfluxDB and VictoriaMetrics fairly, we'll conduct a series of benchmarks in a controlled environment. We'll evaluate their performance in terms of:
- Ingestion Rate: How quickly each database can ingest time-series data.
- Query Performance: The speed at which queries are executed.
- Resource Usage: The impact on CPU, memory, and storage.
Ingestion Rate Benchmark
For the ingestion rate benchmark, we'll generate synthetic time-series data and measure how quickly both databases can ingest it. Here are the results:
- InfluxDB: InfluxDB demonstrates good ingestion rates and can handle a substantial volume of incoming data. However, as the data load increases, it may require more hardware resources to maintain this rate.
- VictoriaMetrics: VictoriaMetrics excels in terms of ingestion rate. It consistently outperforms InfluxDB in handling high write loads, thanks to its efficient storage format and indexing mechanism.
Query Performance Benchmark
In the query performance benchmark, we'll execute various queries against both databases and measure their response times. Here's what we found:
- InfluxDB: InfluxDB performs well in query response times for typical queries. However, as the data volume grows and queries become more complex, the response times can increase significantly.
- VictoriaMetrics: VictoriaMetrics delivers impressive query performance. Its support for PromQL provides powerful querying capabilities, and even with large datasets, it maintains low and predictable query response times.
Resource Usage Benchmark
Resource usage is a critical factor in evaluating time-series databases, as it can impact operational costs. Let's examine how these databases perform in terms of resource utilization:
- InfluxDB: InfluxDB's resource usage increases with data volume. It can demand substantial CPU and memory resources, particularly when handling large datasets or complex queries. This may require regular capacity scaling.
- VictoriaMetrics: VictoriaMetrics excels in resource efficiency. It consumes significantly fewer resources compared to InfluxDB while delivering high performance. Its storage efficiency allows you to store more data with fewer hardware resources.
The following test was run on the following hardware: (Check the full article)
- CPU: i7–7500U
- RAM: 16GB
- Disk: 512GB SSD
The number of concurrent clients: 4.
Total number of inserted values during each test: 30M.
The following time series cardinalities were tested: 1, 10, 100, 1K, 10K, 100K, 1M, 2M, 3M, 4M and 10M.
10 fields per point lead to nice speedup — now VictoriaMetrics reaches 3.6M inserted values per second, while InfluxDB reached 1.5M inserted values per second.
Unfortunately, InfluxDB couldn’t fit more than 2M unique time series into 16GB RAM, so 3M, 4M and 10M cardinalities have no results for InfluxDB :
- VictoriaMetrics has better insert performance than InfluxDB in all the tests. The performance gap between VictoriaMetrics and InfluxDB increases with higher cardinality.
- VictoriaMetrics uses less RAM than InfluxDB on high cardinality time series.
- It is easy to reproduce benchmark results— just run inch tool against docker containers with VictoriaMetrics and InfluxDB on your hardware.
Choosing between InfluxDB and VictoriaMetrics depends on your specific use case and requirements. Here's a summary of their strengths:
- InfluxDB: A versatile database with a SQL-like query language and good ingestion rates. It's an excellent choice for smaller to medium-sized projects or those that prioritize ease of use and integration with Grafana.
- VictoriaMetrics: A high-performance, resource-efficient database designed for large-scale deployments. It excels in handling vast amounts of time-series data while keeping hardware costs low. If you require long-term data retention, scalability, and compatibility with the Prometheus ecosystem, VictoriaMetrics is a compelling choice.
Before making your decision, it's advisable to conduct your benchmarks with your specific workload and infrastructure.
Both InfluxDB and VictoriaMetrics have strong communities and active development, ensuring ongoing improvements and support for your time-series data needs.