Bug #99432 Improving memory barrier during rseg allocation
Submitted: 4 May 2020 8:09 Modified: 4 May 2020 12:46
Reporter: Krunal Bauskar Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:8.0.20 OS:Any
Assigned to: CPU Architecture:ARM
Tags: arm, memory barrier, performance

[4 May 2020 8:09] Krunal Bauskar
Description:
- DML flow allocates rollback segment using a static rollback counter
  (rseg_counter, temp_rseg_counter). Existing code uses atomic operation
  to increment it but fails to specify explicit memory barrier given
  it was originally meant for x86.

- Now that MySQL officially support ARM and given ARM relaxed memory model
  simple increment (not meant for synchronization) can be done using
  relaxed memory barrier that aids in a marginal improvement in performance.

- Also, as part of the change, moved to use std::atomic (C++11).

How to repeat:
- Test any use-case/test-case that exercises the allocation of rollback-segment.
- I tried it using sysbench update-non-index and found that the use of a relaxed memory model improves performance on ARM by up to 2%.

Suggested fix:
Needed patch could be found here.

https://github.com/mysqlonarm/mysql-server/commit/fd1b93c2d11d3e337562c5d4d7369dfdca3226b8

Will also contribute it as part of normal patch contribution given I have signed OCA.
[4 May 2020 12:46] MySQL Verification Team
Hello Mr. Bauskar,

Thank you for your performance improvement report.

I have studied your patch and I think that it makes lots of sense.

Verified as reported.

Thank you, very much, for your contribution.
[5 May 2020 12:04] MySQL Verification Team
Thank you, Mr. Bauskar.

Your patch will be made available to our Development.