Site icon Softizy Blog

MariaDB 10.1 vs MySQL 5.7: Real-World Performances

MySQL vs MariaDB

MySQL 5.7 vs MariaDB 10.1

I) The Best Performances Ever ? Let's have a closer look

MariaDB 10.1 and MySQL 5.7 have been officially GAed for a few weeks now, and each company claims to have awesome performances. MariaDB claims that the biggest improvement on its new version is scalability on massively multithreaded hardware, reaching more than 1 million queries per second on a simplified OLTP benchmark. On the MySQL side, the same type of improvement is achieved on mixed OLTP_RO benchmark.

II) The Real-World Performances

OLTP benchmarks are great, but what is the behaviour of MySQL / MariaDB on real world applications ? We chose to mesure the performance of MySQL and MariaDB on Prestashop 1.6.1.2 which includes our optimizations to improve both the single-threaded and multi-threaded performances.

1) The Configuration

We used a massively multithreaded hardware, an IBM Power 8 S822LC system with 2x10 cores @2.92GHz running in SMT8 mode (160 threads), 256GB of RAM to have the full DB in memory and running on Ubuntu 15.10.

We tuned the PHP and MySQL/MariaDB configuration to optimize systems with such high amount of threads. PHP Configuration :
ServerLimit             16
MaxClients              400
StartServers            3
ThreadLimit             64
ThreadsPerChild         25
MaxRequestWorkers       400
MaxConnectionsPerChild  0
pm =                    dynamic
pm.max_children       = 400
pm.start_servers      = 240
pm.min_spare_servers  = 200
pm.max_spare_servers  = 280
performance_schema                  = OFF
thread_handling                     = pool-of-threads
thread_pool_size                    = 48 # best performances on P8
#innodb_adaptive_hash_index_partitions / innodb_adaptive_hash_index_part is not efficient enough
innodb_adaptive_hash_index          = OFF 
innodb_stats_on_metadata            = OFF
innodb_buffer_pool_size             = 40G
innodb_buffer_pool_instances        = 40
innodb_sync_array_size              = 48
We benched a real shop with: Memcached is used with 128MB of memory. When used, the query cache is set to 128MB. The benchmark results are the average of 5 "siege -i -b -t 20S" (20s benchmark), on a few representative pages, which are generating both read and write operations.

2) The Results

First, let's run the benchmark without the query cache enabled.   In this configuration, we can see three things: Although we often read the query cache is really bad for massively multithreaded hardware because of mutex locking contention, let's take a look at the real results with query cache enabled: In that case, MariaDB 10.1 takes a real benefit from the query cache : it's now faster than MySQL 5.7 in every cases, and up to 266% at 220 connections. At 220 connections, MySQL 5.7 without query cache is also 31% faster than with query cache : we clearly see here the effect of the query cache mutex contention issue. It also shows Prestashop 1.6.1.2 is scaling really well! Here is an additional graph which shows much clearer the difference in performance with and without the query cache with MariaDB 10.1:

3) And the Winner is...

In real world web server configuration, the query cache is often enabled, which is great most of the time. In this configuration, and extrapolating the performance we are seeing with Prestashop, MariaDB 10.1 clearly outperforms MySQL 5.7 on massively multithreaded hardware. We should be able to run a few more tests on multicore Intel processor in a few weeks. We're receiving a lot of questions about our optimizations on the kernel side, more to come on that too, stay tuned and register to our newsletter (no spam, we promise!).    

Contributors: