[MDEV-7962] wsrep_on() takes 0.14% in OLTP RO Created: 2015-04-09 Updated: 2020-05-04 Resolved: 2020-04-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Galera |
| Affects Version/s: | 10.1.6, 10.2.0, 10.3.0, 10.4.0, 10.5.0 |
| Fix Version/s: | 10.1.45, 10.2.32, 10.3.23, 10.4.13, 10.5.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergey Vojtovich | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Epic Link: | Performance: micro optimizations | ||||||||||||||||
| Description |
|
Data comes from Sandy Bridge system running sysbench OLTP RO in 1 thread against 1 table. Call graphs:
wsrep_on() is the one defined in wsrep_mysqld.cc. Most time spent for function call convention. I guess all calls come from InnoDB. Either call WSREP() or cache wsrep_on() value. |
| Comments |
| Comment by Sachin Setiya (Inactive) [ 2016-12-28 ] | |
|
Hi sergey! Can you please provide the options which you used for perf. I attached perf to 2 node galera cluster running sysbench.
But I did not get any kind of call graph expansion for wsrep_on. This is because wsrep_on is called very less. Is there a way in perf to record call graph of less frequent functions ? sudo perf record -p 6520 -g | |
| Comment by Marko Mäkelä [ 2020-04-17 ] | |
|
Quoting some of my analysis from
| |
| Comment by Marko Mäkelä [ 2020-04-17 ] | |
|
The calls to the non-inlined function wsrep_on() were introduced in MariaDB Server 10.1.6 (and in the separate 5.5-galera and 10.0-galera products earlier). Could we replace that function with the macro invocation WSREP_ON and make that macro more efficient, as requested in | |
| Comment by Marko Mäkelä [ 2020-04-24 ] | |
|
I pushed some cleanup to 10.4 to add some short-circuit evaluation before invoking the function. This was a follow-up to As far as I can tell, the reason why the function wsrep_on() exists is that THD is an opaque type for InnoDB, and thus the equivalent macro WSREP(thd) is unavailable to InnoDB. Could we use some other mechanism for this, such as caching the value in innobase_trx_init()? Also, why does the file sql/wsrep_dummy.cc exist? | |
| Comment by Marko Mäkelä [ 2020-04-27 ] | |
|
I will fix this by caching the attribute in trx_t. I do not think that the ‘wsrep-ness’ of a transaction can change after the transaction has been started. | |
| Comment by Marko Mäkelä [ 2020-04-27 ] | |
|
I removed all easily removable wsrep_on() calls from 10.1 and merged that up to 10.4. The code differed between each version quite a bit. For 10.5, there are only a few conflicts, and the code is very similar to 10.4. |