[MDEV-24000] Reduce fil_system.mutex contention Created: 2020-10-21  Updated: 2020-10-28  Resolved: 2020-10-26

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.5.7

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

Issue Links:
Blocks
is blocked by MDEV-23855 InnoDB log checkpointing causes regre... Closed

 Description   

While testing MDEV-23855, it became clear that the fil_system.mutex is a contention point, causing the page cleaner thread to spend 5% of its time on spinning on a mutex. The mutex would be acquired and released several times per page flush operation, mostly by the thread that initiates the write, but also by the I/O completion callback.

In fil_space_t, we should use a single atomic counter with 3 flags, instead of a mix of flags and least 3 counters, some of which are protected by fil_system.mutex. That should reduce the use of fil_system.mutex to the rare cases where files need to be created, opened, or closed.

On Microsoft Windows, a concurrent synchronous write and FlushFileBuffers() on the same file handle will kill performance. Some special tricks will be needed on that platform. This is especially prominent with the synchronous writes for the doublewrite buffer in buf_dblwr_t::flush_buffered_writes().



 Comments   
Comment by Marko Mäkelä [ 2020-10-26 ]

In the end, this was included in MDEV-23855. The observed I/O contention was addressed by making the doublewrite buffer submit asynchronous writes.

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