[MDEV-12345] Performance : Remove calls to clock() in trx_start_low Created: 2017-03-23  Updated: 2022-01-14  Resolved: 2017-03-23

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

Type: Bug Priority: Major
Reporter: Vladislav Vaintroub Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None

Attachments: Zip Archive 10.2.callgraph.G.txt.zip     Text File remove_clock.txt     Text File with_clock.txt    

 Description   

The point-select sysbench benchmark I ran recently on 10.2 shows rather high time spent in
high resolution timer syscalls (clock_gettime on Linux, and QueryPerformanceCounter on Windows)

The inspection reveals that clock() call introduced inside trx_start_low by this patch https://github.com/MariaDB/server/commit/74961760a4837d2deb33336329c28cf9ad9b4e9e is responsible for the most calls (also, in 10.2, clock() was erroneously done twice).

The call can be replaced by the value of THD::start_utime.



 Comments   
Comment by Vladislav Vaintroub [ 2017-03-23 ]

Attached callgraph data taken with perf during the sysbench run

Comment by Marko Mäkelä [ 2017-03-23 ]

The fix looks OK to me.

Comment by Vladislav Vaintroub [ 2017-03-23 ]

Attached are the non-transactional point-select benchmark numbers ran with 256 user on a 32core machine (it is 10.2)., with or without clock() in trx_start_ow. Quite surprising speedup (more than 3 times, from 126325 to 379186 qps). On a weaker Windows box that I have tested, it was more like 15% improvement. clock_get_time must be very expensive on this benchmark machine.

Comment by Vladislav Vaintroub [ 2017-03-23 ]

Fixed in 10.1 now

Generated at Thu Feb 08 07:56:59 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.