Table of contents of the article:
In recent years, the world of relational databases has seen numerous developments, with MariaDB and MySQL continuing to compete for performance supremacy. With the introduction of MariaDB 11.4, the competition has reached a new level. Recent analyzes as of April 2024, (just 2 months from the writing of this post) and benchmarks conducted by Mark Callaghan, a renowned SQL expert and leading figure in the database industry, have highlighted that MariaDB 11.4 offers superior performance over MySQL in the tested configurations. This article will explore the details of these benchmarks and analyze the reasons behind MariaDB's superiority.
Mark Callaghan is a well-known name in the world of relational databases and SQL performance. With over two decades of experience, Mark has worked with some of the industry's most influential companies, including Google, where he significantly contributed to the optimization of MySQL for large-scale workloads. He is known for his deep technical knowledge and his ability to perform detailed and unbiased benchmarking, which has helped many organizations improve their database infrastructures.
Mark, an oracle in his field, runs the blog “Small Datum“, where he regularly shares his analyzes and the results of the benchmarks he runs on various versions of MariaDB and MySQL. His articles are renowned for their transparency and data accuracy, becoming a key resource for developers and database engineers around the world. His experience and contributions to the community have made his ratings particularly respected and trusted.
Benchmarks and Methodology
Mark Callaghan conducted a series of benchmarks using Sysbench, a popular database benchmarking tool, on server configurations of various sizes. Key studies considered for this article include:
These benchmarks compared the performance of MariaDB 11.4 to various versions of MySQL (5.6, 5.7, and 8.0), focusing on different query types and workloads, including point queries, range queries, and write operations.
Benchmark Results
Sysbench on a Small Server
The first benchmark was conducted on a small server, equipped with an i7 CPU, 16GB of RAM and an M.2 storage device. The test tables were fully cached by InnoDB. The results revealed that MariaDB was able to avoid CPU regressions over time, in contrast to MySQL, which showed a tendency towards regressions with the introduction of new features.
In particular, MariaDB 11.4 recorded a throughput (QPS) of between 113% and 122% compared to MySQL 8.0.36 in the various microbenchmarks. This data highlights that MariaDB has not only maintained performance, but has also significantly improved it compared to previous versions and compared to MySQL. For example, in the point query test, MariaDB outperformed MySQL with an average of 150,000 QPS versus MySQL's 130,000 QPS.
Sysbench on a Less Small Server
A similar benchmark was run on a server with slightly more powerful configurations, including a more modern CPU and higher RAM capacity. Even in this scenario, the results confirmed the superiority of MariaDB. The database showed greater efficiency in CPU usage, achieving higher throughputs in almost all tests. For example, during range queries, MariaDB averaged 140,000 QPS, while MySQL averaged 125,000 QPS.
The Insertion Benchmark
The Insert Benchmark measures the speed and efficiency of write operations, which are critical for applications that require a high rate of inserts and updates, such as e-commerce platforms and content management systems. In this test, MariaDB once again outperformed MySQL. MariaDB recorded 15% higher write throughput than MySQL, averaging 120,000 insert operations per second versus MySQL's 105,000. This result is particularly significant for data-intensive applications, where input speed can directly influence overall system performance.
Performance Analysis
The reasons behind MariaDB's superiority can be attributed to several key factors:
Storage Engine Optimizations
MariaDB has continued to improve its InnoDB storage engine, introducing specific optimizations that reduce CPU overhead and improve memory management. This includes improvements in the buffer pool, which allows faster access to frequently used data, and the adoption of advanced data compression techniques to reduce storage space usage and increase read and write performance.
For example, MariaDB has integrated the zlib compression algorithm, which significantly reduces disk space consumption and improves I/O throughput. Furthermore, optimizations in lock-free mechanisms and transaction management have helped reduce latency and increase overall system efficiency.
Competition Improvements
The new versions of MariaDB include significant improvements in concurrency management, reducing bottlenecks and improving overall throughput. This was achieved through the implementation of more efficient locking schemes and the optimization of query scheduling algorithms.
In particular, the introduction of parallel replication has made it possible to significantly improve performance in multi-threaded environments, where replication operations can be performed in parallel, reducing latency times and increasing the throughput of replication operations. These improvements are especially useful in high-concurrency scenarios, such as e-commerce systems and high-traffic web applications.
Avoid Regressions
Unlike MySQL, MariaDB has proven to be more careful about avoiding performance regressions, ensuring that new features do not compromise existing performance. This was achieved through a rigorous continuous testing and benchmarking process, which allows any regressions to be identified and resolved before the release of new versions.
A concrete example of this commitment is the Continuous Integration (CI) process adopted by MariaDB, which includes a suite of performance tests performed on each code commit. This proactive approach ensures that each new feature is thoroughly tested and optimized, minimizing the risk of regressions and ensuring continuous performance improvement.
Community Support and Collaboration
MariaDB benefits from strong support from the open source community, which contributes patches, optimizations and ongoing feedback. The MariaDB community is made up of developers, users, and companies who actively collaborate to improve the software, fix bugs, and add new features.
This open collaboration has helped accelerate the development and deployment of new technologies, such as support for the ARM architecture and optimizations for cloud-native workloads. Additionally, the community provides valuable feedback that helps quickly identify and resolve performance issues, ensuring MariaDB remains at the forefront of the relational database industry.
A real case of one of our clients who migrated from Percona Server 5.7 to MariaDB 11.4
One of our customers with international traffic who traveled at all times of the day with a load average between 8 and 10, saw the load literally halve after switching from Percona Server 5.7 to MariaDB 11.4.
Conclusions
Analysis and benchmarking conducted by Mark Callaghan clearly highlights that MariaDB 11.4 is currently faster than MySQL in the tested configurations. This makes MariaDB a preferable choice for many applications that require high performance and reliability.
For those who wish to delve deeper into the technical details of the benchmarks, we recommend consulting Mark Callaghan's original posts on Small Datum.
MariaDB continues to evolve, offering constant improvements and maintaining a strong commitment to performance optimization. While MySQL remains a popular choice, MariaDB 11.4 is an excellent option for those looking for maximum performance in relational databases.