[MDEV-26855] Enable spinning for log_sys_mutex and log_flush_order_mutex Created: 2021-10-19  Updated: 2023-03-08  Resolved: 2021-10-19

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.6
Fix Version/s: 10.6.5

Type: Bug Priority: Major
Reporter: Krunal Bauskar Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: performance

Attachments: PNG File arm.png     PNG File x86.png    
Issue Links:
Duplicate
is duplicated by MDEV-30481 Hard lock up with queries in "Opening... Closed
Relates
relates to MDEV-23855 InnoDB log checkpointing causes regre... Closed

 Description   

As part of MDEV-26779 we first discovered the effect of enabling spinning for some critical mutex.
MDEV-26779 tried enabling it for lock_sys.wait_mutex and observed a good gain in performance.

In yet another discussion, Mark Callaghan pointed to a reference to pthread based mutex spin using PTHREAD_MUTEX_ADAPTIVE_NP (MDEV-26769 Intel RTM).

Given the strong references, Marko Makela as part of his comment in #1923 pointed an idea to enable
spinning for other mutexes. Based on perf profiling we decided to explore spinning for
log_sys_mutex and log_flush_order_mutex as they are occupying the top slots in the contented mutex list.

The evaluation showed promising results for ARM64 but not for x86.
So a patch is here-by proposed to enable the spinning of the mutex for ARM-based platform.



 Comments   
Comment by Krunal Bauskar [ 2021-10-19 ]

patch submitted: https://github.com/MariaDB/server/pull/1935

Comment by Krunal Bauskar [ 2021-10-19 ]

On ARM, performance gain in the range of 10-60% is observed.

Comment by Marko Mäkelä [ 2021-10-19 ]

The spinloops were deliberately disabled as part of MDEV-23855 already in MariaDB Server 10.5.7.

Several things have changed between 10.5 and 10.6, so it is not too surprising that the spinning may be helpful again.

Generated at Thu Feb 08 09:48:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.