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.
Attachments
Issue Links
causes
MDEV-22452Missing call to wsrep_commit_ordered in trx_t::commit
Closed
relates to
MDEV-22203WSREP_ON is unnecessarily expensive to evaluate
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.
Marko Mäkelä
added a comment - 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.
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.
Marko Mäkelä
added a comment - 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.
I pushed some cleanup to 10.4 to add some short-circuit evaluation before invoking the function. This was a follow-up to MDEV-22203, which introduces a global variable to speed up WSREP.
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?
Marko Mäkelä
added a comment - I pushed some cleanup to 10.4 to add some short-circuit evaluation before invoking the function. This was a follow-up to MDEV-22203 , which introduces a global variable to speed up WSREP .
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?
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 MDEV-22203?
Marko Mäkelä
added a comment - 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 MDEV-22203 ?
Marko Mäkelä
added a comment - Quoting some of my analysis from MDEV-22203 :
The macro WSREP_ON used to be defined simply as an alias the global Boolean variable global_system_variables.wsrep_on . A more complex variant that invokes strcmp was introduced, in MDEV-16799 renamed to WSREP_ON_NEW , and related to MDEV-16405 (Galera 4) in 10.4.2 the more efficient macro WSREP_ON was replaced altogether .
Can you please provide the options which you used for perf. I attached perf to 2 node galera cluster running sysbench.
0.05% 0.05% mysqld mysqld [.] wsrep_on
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 ?
I used this for perf
sudo perf record -p 6520 -g
Sachin Setiya (Inactive)
added a comment - Hi sergey!
Can you please provide the options which you used for perf. I attached perf to 2 node galera cluster running sysbench.
0.05 % 0.05 % mysqld mysqld [.] wsrep_on
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 ?
I used this for perf
sudo perf record -p 6520 -g
People
Marko Mäkelä
Sergey Vojtovich
Votes:
0Vote for this issue
Watchers:
4Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":1443.9000000953674,"ttfb":413.19999980926514,"pageVisibility":"visible","entityId":50817,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"ec993cf8-5a17-45f8-93d5-d1fbe2ec2d9d","navigationType":0,"readyForUser":1518.0999999046326,"redirectCount":0,"resourceLoadedEnd":2190.4000000953674,"resourceLoadedStart":443.90000009536743,"resourceTiming":[{"duration":491.19999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":443.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":443.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":935.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":491.2000002861023,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":444.2999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":444.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":935.5,"responseStart":0,"secureConnectionStart":0},{"duration":546.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":444.40000009536743,"connectEnd":444.40000009536743,"connectStart":444.40000009536743,"domainLookupEnd":444.40000009536743,"domainLookupStart":444.40000009536743,"fetchStart":444.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":444.40000009536743,"responseEnd":990.6999998092651,"responseStart":990.6999998092651,"secureConnectionStart":444.40000009536743},{"duration":604.7000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":444.69999980926514,"connectEnd":444.69999980926514,"connectStart":444.69999980926514,"domainLookupEnd":444.69999980926514,"domainLookupStart":444.69999980926514,"fetchStart":444.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":444.69999980926514,"responseEnd":1049.4000000953674,"responseStart":1049.4000000953674,"secureConnectionStart":444.69999980926514},{"duration":608.1999998092651,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":444.90000009536743,"connectEnd":444.90000009536743,"connectStart":444.90000009536743,"domainLookupEnd":444.90000009536743,"domainLookupStart":444.90000009536743,"fetchStart":444.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":444.90000009536743,"responseEnd":1053.0999999046326,"responseStart":1053.0999999046326,"secureConnectionStart":444.90000009536743},{"duration":608.4000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":445.09999990463257,"connectEnd":445.09999990463257,"connectStart":445.09999990463257,"domainLookupEnd":445.09999990463257,"domainLookupStart":445.09999990463257,"fetchStart":445.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":445.09999990463257,"responseEnd":1053.5,"responseStart":1053.5,"secureConnectionStart":445.09999990463257},{"duration":608.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":445.2999997138977,"connectEnd":445.2999997138977,"connectStart":445.2999997138977,"domainLookupEnd":445.2999997138977,"domainLookupStart":445.2999997138977,"fetchStart":445.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":445.2999997138977,"responseEnd":1053.9000000953674,"responseStart":1053.9000000953674,"secureConnectionStart":445.2999997138977},{"duration":687.1999998092651,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":445.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":445.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1132.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":608.8000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":445.59999990463257,"connectEnd":445.59999990463257,"connectStart":445.59999990463257,"domainLookupEnd":445.59999990463257,"domainLookupStart":445.59999990463257,"fetchStart":445.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":445.59999990463257,"responseEnd":1054.4000000953674,"responseStart":1054.4000000953674,"secureConnectionStart":445.59999990463257},{"duration":686.9000000953674,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":445.7999997138977,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":445.7999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1132.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":608.8999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":445.90000009536743,"connectEnd":445.90000009536743,"connectStart":445.90000009536743,"domainLookupEnd":445.90000009536743,"domainLookupStart":445.90000009536743,"fetchStart":445.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":445.90000009536743,"responseEnd":1054.7999997138977,"responseStart":1054.7999997138977,"secureConnectionStart":445.90000009536743},{"duration":1275.7999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":446.90000009536743,"connectEnd":446.90000009536743,"connectStart":446.90000009536743,"domainLookupEnd":446.90000009536743,"domainLookupStart":446.90000009536743,"fetchStart":446.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":446.90000009536743,"responseEnd":1722.6999998092651,"responseStart":1722.6999998092651,"secureConnectionStart":446.90000009536743},{"duration":1743.4000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":447,"connectEnd":447,"connectStart":447,"domainLookupEnd":447,"domainLookupStart":447,"fetchStart":447,"redirectEnd":0,"redirectStart":0,"requestStart":447,"responseEnd":2190.4000000953674,"responseStart":2190.2999997138977,"secureConnectionStart":447},{"duration":582.1000003814697,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1144.2999997138977,"connectEnd":1144.2999997138977,"connectStart":1144.2999997138977,"domainLookupEnd":1144.2999997138977,"domainLookupStart":1144.2999997138977,"fetchStart":1144.2999997138977,"redirectEnd":0,"redirectStart":0,"requestStart":1144.2999997138977,"responseEnd":1726.4000000953674,"responseStart":1726.4000000953674,"secureConnectionStart":1144.2999997138977},{"duration":789.2000002861023,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1437.6999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1437.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":2226.9000000953674,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":248,"responseStart":413,"responseEnd":418,"domLoading":441,"domInteractive":2233,"domContentLoadedEventStart":2233,"domContentLoadedEventEnd":2280,"domComplete":3016,"loadEventStart":3016,"loadEventEnd":3017,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":2194.7999997138977},{"name":"bigPipe.sidebar-id.end","time":2195.699999809265},{"name":"bigPipe.activity-panel-pipe-id.start","time":2196},{"name":"bigPipe.activity-panel-pipe-id.end","time":2198.0999999046326},{"name":"activityTabFullyLoaded","time":2296.7999997138977}],"measures":[],"correlationId":"3fb18e208abc00","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":107,"dbReadsTimeInMs":16,"dbConnsTimeInMs":25,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
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.