← Back to team overview

maria-developers team mailing list archive

MariaDB scalability: mutexes

 

Hi Axel,

I benchmarked various mutexes available to MariaDB. Results are here:
http://svoj-db.blogspot.ru/2014/02/mariadb-mutexes-scalability.html

Among other things I noticed that normal mutexes scale better than adaptive.
And it looks like it gives over 5 000 TPS in my benchmarks:

Original
--------
64 threads, time spent: 60s, queries executed: 11500723, qps: 191678, 1 thread qps: 2994, tps: 13691
64 threads, time spent: 60s, queries executed: 10983665, qps: 183061, 1 thread qps: 2860, tps: 13075
64 threads, time spent: 60s, queries executed: 11080325, qps: 184672, 1 thread qps: 2885, tps: 13190

slow LOCK_open
--------------
64 threads, time spent: 60s, queries executed: 12948365, qps: 215806, 1 thread qps: 3371, tps: 15414
64 threads, time spent: 60s, queries executed: 13191584, qps: 219859, 1 thread qps: 3435, tps: 15704
64 threads, time spent: 60s, queries executed: 13050647, qps: 217510, 1 thread qps: 3398, tps: 15536

slow LOCK_open + THR_LOCK::mutex
--------------------------------
64 threads, time spent: 60s, queries executed: 15863174, qps: 264386, 1 thread qps: 4131, tps: 18884
64 threads, time spent: 60s, queries executed: 15761944, qps: 262699, 1 thread qps: 4104, tps: 18764
64 threads, time spent: 60s, queries executed: 15773239, qps: 262887, 1 thread qps: 4107, tps: 18777

Could you do official benchmarks (patch attached)? It would be nice to also
benchmark MySQL-5.6 with thr_lock part of the patch.

Thanks,
Sergey
=== modified file 'mysys/thr_lock.c'
--- mysys/thr_lock.c	2012-09-27 18:09:46 +0000
+++ mysys/thr_lock.c	2014-02-24 01:31:42 +0000
@@ -424,7 +424,7 @@
 {
   DBUG_ENTER("thr_lock_init");
   bzero((char*) lock,sizeof(*lock));
-  mysql_mutex_init(key_THR_LOCK_mutex, &lock->mutex, MY_MUTEX_INIT_FAST);
+  mysql_mutex_init(key_THR_LOCK_mutex, &lock->mutex, MY_MUTEX_INIT_SLOW);
   lock->read.last= &lock->read.data;
   lock->read_wait.last= &lock->read_wait.data;
   lock->write_wait.last= &lock->write_wait.data;

=== modified file 'sql/table_cache.cc'
--- sql/table_cache.cc	2014-02-13 07:13:55 +0000
+++ sql/table_cache.cc	2014-02-24 01:27:08 +0000
@@ -446,7 +446,7 @@
   init_tc_psi_keys();
 #endif
   tdc_inited= true;
-  mysql_mutex_init(key_LOCK_open, &LOCK_open, MY_MUTEX_INIT_FAST);
+  mysql_mutex_init(key_LOCK_open, &LOCK_open, MY_MUTEX_INIT_SLOW);
   mysql_mutex_record_order(&LOCK_active_mi, &LOCK_open);
   /*
     We must have LOCK_open before LOCK_global_system_variables because


Follow ups