Bug #90604 ut_rnd_ulint_counter () : Default delay for spin wait gives better performance
Submitted: 24 Apr 2018 13:50 Modified: 25 Apr 2018 4:41
Reporter: Sandeep Sethia (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S5 (Performance)
Version:5.7 OS:CentOS
Assigned to: CPU Architecture:Any
Tags: innodb

[24 Apr 2018 13:50] Sandeep Sethia
Description:
Hi ,

Instead of using the random function ut_rnd_ulint_counter () for causing a sleep wait delay we can use the default value of 6 for doing the backoff.

The current code uses a thread local variable for maintaining the counter value .
The entire function call can be removed if we use a default value of 6 for spin wait delay or whatever value spin wait delay is set to.

ex :    
-         ut_delay(ut_rnd_interval(0, max_delay));
+         ut_delay(max_delay);

Verified the patch in Intel,ARM and gives a 5-8% performance benefit across platforms for update queries in Sysbench update_index.lua test cases.

How to repeat:
Please run sysbench update index test for thread value such as 64,128 etc.
[24 Apr 2018 13:51] Sandeep Sethia
Patch submission

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: cache_line_contention.patch.txt (text/plain), 2.85 KiB.

[25 Apr 2018 4:41] Umesh Shastry
Hello Sandeep,

Thank you for the report and contribution.

Thanks,
Umesh