Bug #73763 New futex-mutex in InnoDB needs perf attention
Submitted: 28 Aug 2014 21:47 Modified: 26 Oct 2016 14:48
Reporter: Mark Callaghan Email Updates:
Status: In progress Impact on me:
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[28 Aug 2014 21:47] Mark Callaghan
Performance evaluation for the new InnoDB futex-mutex (TTASFutexMutex) is here:

In some cases performance with it is much worse than the alternatives (pthread default, pthread adaptive). If nothing else I think we need a my.cnf option to choose between using it and something else. I also think we should have a my.cnf option to disable all use of PTHREAD_MUTEX_ADAPTIVE_NP in mysqld because I don't think it works as good as it was expected to work.

How to repeat:
Read blog posts, download & compile innotsim, run innotsim
Or run real mysqld workloads
[29 Aug 2014 14:12] Mark Callaghan
My request has 2 parts:

1) must have -- make performance of the futex-mutex always better than syncarray mutex. From my test it is better sometimes and worse sometimes. I don't understand why it is worse sometimes. I know why it is better -- it avoids broadcast on mutex unlock. 

2) nice to have -- make the choice of ib_mutex_t a my.cnf option
3) nice to have -- use different implementations depending on the use case -- maybe futex-mutex for some things, default pthread mutex for others


I won't mind if this gets closed without doing #2 or #3. This is really open for #1.
[8 Mar 2016 22:55] Daniel Black
with http://dev.mysql.com/worklog/task/?id=6044 closed is this complete now?
[26 Oct 2016 14:48] MySQL Verification Team

Although WL#6044 is completed in 5.7, still all the tests that bug reporter asked for are not executed, as far as I know.

Hence, I am alerting the responsible engineers to provide more definite answers.
[26 Oct 2016 15:20] Sunny Bains
WL#6044 added the FutexMutex, it was an experimental mutex type. The mutex code refactoring was done to make our life easier. So that it is easier to implement different mutex types without changing InnoDB code. FutexMutex was used to test this drop in replacement. The EventMutex type seems to work fine on x86_64 and we don't have any open issues on our supported platforms. 

There are performance issues on ARM and POWER8 due to extra barriers, we are aware of the problem. We are reviewing some of the contributed patches.