Type:
Task
Priority:
Major
Resolution:
Unresolved
Fix Version/s:
None
While testing MySQL, however same code still in MariaDB, I came across this performance problem where loading the global variables btr_search_enabled. The load of this memory location was a hot point in the code.
It turns out during compilation that btr_search_enabled was placed on a shared cache line address as ut_rnd_ulint_counter and the system was extensively using random numbers. The result is that a critical path of innodb was slow as this global variable was frequently expelled from the CPU caches and access was only granted to read it to one of the CPUs at a time.
This is a more general problem that SQL global variables are mostly read only and there is a proliferation of statistics counters and other static variables that could be innocently placed beside a C++ variable in the linker stage.
To resolve this, a similar mechanism to the linux kernel is used to use attributes to mark global variables that are read_mostly and put them in the same section. Because they are in the same section they are prevented from false sharing with other static variables.
The attached patch demonstrates this concept, however extending this to every global variable would bit rot and be susceptible to merge conflicts.
As an extension to this, global variables that are copied to session variables could also be in their own section so when the start of the global -> session occurs, they are all the same pre-fetched cache-line.
relates to
MDEV-24051
Remapping .text and .data application segments to huge pages
Open
links to
{"report":{"fcp":659.3000001907349,"ttfb":153.80000019073486,"pageVisibility":"visible","entityId":80694,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"afef15f4-4aca-4646-a4fc-5aa6d55be4ce","navigationType":0,"readyForUser":783.9000000953674,"redirectCount":0,"resourceLoadedEnd":716.8000001907349,"resourceLoadedStart":159.30000019073486,"resourceTiming":[{"duration":7.099999904632568,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":159.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":159.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":166.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":8,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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","startTime":159.60000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":159.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":167.60000014305115,"responseStart":0,"secureConnectionStart":0},{"duration":72.89999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/fbf975c0cce4b1abf04784eeae9ba1f4-CDN/lu2bu7/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":159.60000014305115,"connectEnd":159.60000014305115,"connectStart":159.60000014305115,"domainLookupEnd":159.60000014305115,"domainLookupStart":159.60000014305115,"fetchStart":159.60000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":159.60000014305115,"responseEnd":232.5,"responseStart":232.5,"secureConnectionStart":159.60000014305115},{"duration":187.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/099b33461394b8015fc36c0a4b96e19f-CDN/lu2bu7/820016/12ta74/8679b4946efa1a0bb029a3a22206fb5d/_/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","startTime":159.70000004768372,"connectEnd":159.70000004768372,"connectStart":159.70000004768372,"domainLookupEnd":159.70000004768372,"domainLookupStart":159.70000004768372,"fetchStart":159.70000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":159.70000004768372,"responseEnd":347.10000014305115,"responseStart":347.10000014305115,"secureConnectionStart":159.70000004768372},{"duration":190.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/94c15bff32baef80f4096a08aceae8bc-CDN/lu2bu7/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":159.90000009536743,"connectEnd":159.90000009536743,"connectStart":159.90000009536743,"domainLookupEnd":159.90000009536743,"domainLookupStart":159.90000009536743,"fetchStart":159.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":159.90000009536743,"responseEnd":350.40000009536743,"responseStart":350.40000009536743,"secureConnectionStart":159.90000009536743},{"duration":191.29999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":159.90000009536743,"connectEnd":159.90000009536743,"connectStart":159.90000009536743,"domainLookupEnd":159.90000009536743,"domainLookupStart":159.90000009536743,"fetchStart":159.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":159.90000009536743,"responseEnd":351.2000000476837,"responseStart":351.2000000476837,"secureConnectionStart":159.90000009536743},{"duration":191.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":160,"connectEnd":160,"connectStart":160,"domainLookupEnd":160,"domainLookupStart":160,"fetchStart":160,"redirectEnd":0,"redirectStart":0,"requestStart":160,"responseEnd":351.90000009536743,"responseStart":351.90000009536743,"secureConnectionStart":160},{"duration":192.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2bu7/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":160.10000014305115,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":160.10000014305115,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":352.60000014305115,"responseStart":0,"secureConnectionStart":0},{"duration":192.09999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":160.30000019073486,"connectEnd":160.30000019073486,"connectStart":160.30000019073486,"domainLookupEnd":160.30000019073486,"domainLookupStart":160.30000019073486,"fetchStart":160.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":160.30000019073486,"responseEnd":352.40000009536743,"responseStart":352.40000009536743,"secureConnectionStart":160.30000019073486},{"duration":192.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2bu7/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":160.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":160.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":352.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":192.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/3339d87fa2538a859872f2df449bf8d0-CDN/lu2bu7/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":160.5,"connectEnd":160.5,"connectStart":160.5,"domainLookupEnd":160.5,"domainLookupStart":160.5,"fetchStart":160.5,"redirectEnd":0,"redirectStart":0,"requestStart":160.5,"responseEnd":353,"responseStart":353,"secureConnectionStart":160.5},{"duration":503.7000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":161.20000004768372,"connectEnd":161.20000004768372,"connectStart":161.20000004768372,"domainLookupEnd":161.20000004768372,"domainLookupStart":161.20000004768372,"fetchStart":161.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":161.20000004768372,"responseEnd":664.9000000953674,"responseStart":664.9000000953674,"secureConnectionStart":161.20000004768372},{"duration":505.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":161.20000004768372,"connectEnd":161.20000004768372,"connectStart":161.20000004768372,"domainLookupEnd":161.20000004768372,"domainLookupStart":161.20000004768372,"fetchStart":161.20000004768372,"redirectEnd":0,"redirectStart":0,"requestStart":161.20000004768372,"responseEnd":666.5,"responseStart":666.5,"secureConnectionStart":161.20000004768372},{"duration":246.80000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":386,"connectEnd":386,"connectStart":386,"domainLookupEnd":386,"domainLookupStart":386,"fetchStart":386,"redirectEnd":0,"redirectStart":0,"requestStart":386,"responseEnd":632.8000001907349,"responseStart":632.8000001907349,"secureConnectionStart":386},{"duration":31.399999856948853,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":652.1000001430511,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":652.1000001430511,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":683.5,"responseStart":0,"secureConnectionStart":0},{"duration":22.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2bu7/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":676.1000001430511,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":676.1000001430511,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":698.6000001430511,"responseStart":0,"secureConnectionStart":0},{"duration":22.200000047683716,"initiatorType":"link","name":"https://jira.mariadb.org/s/50bc9be5bfead1a25e72c1a9338c94f6-CDN/lu2bu7/820016/12ta74/e108c7645258ccb43280ed3404e3e949/_/download/contextbatch/css/com.atlassian.jira.plugins.jira-development-integration-plugin:0,-_super,-jira.view.issue,-jira.global,-jira.general,-jira.browse.project,-project.issue.navigator,-atl.general/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":676.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":676.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":698.7000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":34.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2bu7/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":677.2000000476837,"connectEnd":677.2000000476837,"connectStart":677.2000000476837,"domainLookupEnd":677.2000000476837,"domainLookupStart":677.2000000476837,"fetchStart":677.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":677.2000000476837,"responseEnd":711.6000001430511,"responseStart":711.6000001430511,"secureConnectionStart":677.2000000476837},{"duration":37.799999952316284,"initiatorType":"script","name":"https://jira.mariadb.org/s/f51ef5507eea4c158f257c66c93b2a3f-CDN/lu2bu7/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":677.7000000476837,"connectEnd":677.7000000476837,"connectStart":677.7000000476837,"domainLookupEnd":677.7000000476837,"domainLookupStart":677.7000000476837,"fetchStart":677.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":677.7000000476837,"responseEnd":715.5,"responseStart":715.5,"secureConnectionStart":677.7000000476837},{"duration":38.60000014305115,"initiatorType":"script","name":"https://jira.mariadb.org/s/86ee9bbc76cd1bcd8556fcdcf46241c9-CDN/lu2bu7/820016/12ta74/e108c7645258ccb43280ed3404e3e949/_/download/contextbatch/js/com.atlassian.jira.plugins.jira-development-integration-plugin:0,-_super,-jira.view.issue,-jira.global,-jira.general,-jira.browse.project,-project.issue.navigator,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":678.2000000476837,"connectEnd":678.2000000476837,"connectStart":678.2000000476837,"domainLookupEnd":678.2000000476837,"domainLookupStart":678.2000000476837,"fetchStart":678.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":678.2000000476837,"responseEnd":716.8000001907349,"responseStart":716.8000001907349,"secureConnectionStart":678.2000000476837}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":31,"responseStart":154,"responseEnd":155,"domLoading":157,"domInteractive":851,"domContentLoadedEventStart":851,"domContentLoadedEventEnd":903,"domComplete":1573,"loadEventStart":1573,"loadEventEnd":1574,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":820.7000000476837},{"name":"bigPipe.sidebar-id.end","time":821.4000000953674},{"name":"bigPipe.activity-panel-pipe-id.start","time":821.6000001430511},{"name":"bigPipe.activity-panel-pipe-id.end","time":824.1000001430511},{"name":"activityTabFullyLoaded","time":909.6000001430511}],"measures":[],"correlationId":"ed86c6db6d0682","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":68,"dbReadsTimeInMs":9,"dbConnsTimeInMs":16,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}