MDEV-14425 improved write performance less than it was hoped. We are still seeing log_sys.mutex and buf_pool.mutex dominating the wait times.
A prominent bottleneck was identified to be log_sys.mutex between log_sys.append_prepare() and log_close(). To protect the copying of data to log_sys.buf, we only need a shared log_sys.latch, which can replace log_sys.mutex and log_sys.flush_order_mutex. The log_sys.lsn and the position of log_sys.buf needs to be protected by a new log_sys.lsn_lock. Writes of log_sys.buf to the file system will have to acquire exclusive log_sys.latch.
While working on this code, we can also make mtr_t::commit() invoke buf_pool.page_cleaner_wakeup() and update Innodb_buffer_pool_write_requests at most once per call.
{"report":{"fcp":915.8000001907349,"ttfb":329.30000019073486,"pageVisibility":"visible","entityId":107712,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"8d4417bd-d2a3-4af1-84c1-e3224427d140","navigationType":0,"readyForUser":1062.7000002861023,"redirectCount":0,"resourceLoadedEnd":733.3000001907349,"resourceLoadedStart":338.30000019073486,"resourceTiming":[{"duration":42.09999990463257,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":338.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":338.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":380.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":43.09999990463257,"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":338.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":338.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":382,"responseStart":0,"secureConnectionStart":0},{"duration":106.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":339.30000019073486,"connectEnd":339.30000019073486,"connectStart":339.30000019073486,"domainLookupEnd":339.30000019073486,"domainLookupStart":339.30000019073486,"fetchStart":339.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":385.7000002861023,"responseEnd":446.1000003814697,"responseStart":398.90000009536743,"secureConnectionStart":339.30000019073486},{"duration":129.09999990463257,"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":340.90000009536743,"connectEnd":340.90000009536743,"connectStart":340.90000009536743,"domainLookupEnd":340.90000009536743,"domainLookupStart":340.90000009536743,"fetchStart":340.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":386.80000019073486,"responseEnd":470,"responseStart":401.5,"secureConnectionStart":340.90000009536743},{"duration":64.09999990463257,"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":341.2000002861023,"connectEnd":341.2000002861023,"connectStart":341.2000002861023,"domainLookupEnd":341.2000002861023,"domainLookupStart":341.2000002861023,"fetchStart":341.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":388.2000002861023,"responseEnd":405.30000019073486,"responseStart":404.30000019073486,"secureConnectionStart":341.2000002861023},{"duration":75.2000002861023,"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":341.40000009536743,"connectEnd":341.40000009536743,"connectStart":341.40000009536743,"domainLookupEnd":341.40000009536743,"domainLookupStart":341.40000009536743,"fetchStart":341.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":391,"responseEnd":416.6000003814697,"responseStart":415.80000019073486,"secureConnectionStart":341.40000009536743},{"duration":75.89999961853027,"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":341.6000003814697,"connectEnd":341.6000003814697,"connectStart":341.6000003814697,"domainLookupEnd":341.6000003814697,"domainLookupStart":341.6000003814697,"fetchStart":341.6000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":391.2000002861023,"responseEnd":417.5,"responseStart":416.7000002861023,"secureConnectionStart":341.6000003814697},{"duration":48.200000286102295,"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":343,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":343,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":391.2000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":86.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":343.1000003814697,"connectEnd":343.1000003814697,"connectStart":343.1000003814697,"domainLookupEnd":343.1000003814697,"domainLookupStart":343.1000003814697,"fetchStart":343.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":394.40000009536743,"responseEnd":429.30000019073486,"responseStart":428.30000019073486,"secureConnectionStart":343.1000003814697},{"duration":50.80000019073486,"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":343.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":343.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":394.1000003814697,"responseStart":0,"secureConnectionStart":0},{"duration":71.80000019073486,"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":343.5,"connectEnd":398.7000002861023,"connectStart":398.7000002861023,"domainLookupEnd":398.7000002861023,"domainLookupStart":398.7000002861023,"fetchStart":343.5,"redirectEnd":0,"redirectStart":0,"requestStart":399.7000002861023,"responseEnd":415.30000019073486,"responseStart":411.7000002861023,"secureConnectionStart":398.7000002861023},{"duration":367.80000019073486,"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":363,"connectEnd":363,"connectStart":363,"domainLookupEnd":363,"domainLookupStart":363,"fetchStart":363,"redirectEnd":0,"redirectStart":0,"requestStart":481.30000019073486,"responseEnd":730.8000001907349,"responseStart":722.2000002861023,"secureConnectionStart":363},{"duration":368.19999980926514,"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":365.1000003814697,"connectEnd":365.1000003814697,"connectStart":365.1000003814697,"domainLookupEnd":365.1000003814697,"domainLookupStart":365.1000003814697,"fetchStart":365.1000003814697,"redirectEnd":0,"redirectStart":0,"requestStart":584.7000002861023,"responseEnd":733.3000001907349,"responseStart":729.5,"secureConnectionStart":365.1000003814697},{"duration":218.10000038146973,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":657,"connectEnd":657,"connectStart":657,"domainLookupEnd":657,"domainLookupStart":657,"fetchStart":657,"redirectEnd":0,"redirectStart":0,"requestStart":838.9000000953674,"responseEnd":875.1000003814697,"responseStart":874.3000001907349,"secureConnectionStart":657},{"duration":188.2999997138977,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":894.7000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":894.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1083,"responseStart":0,"secureConnectionStart":0},{"duration":242.5,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":919.3000001907349,"connectEnd":919.3000001907349,"connectStart":919.3000001907349,"domainLookupEnd":919.3000001907349,"domainLookupStart":919.3000001907349,"fetchStart":919.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1123,"responseEnd":1161.8000001907349,"responseStart":1160.9000000953674,"secureConnectionStart":919.3000001907349}],"fetchStart":1,"domainLookupStart":1,"domainLookupEnd":1,"connectStart":1,"connectEnd":1,"requestStart":157,"responseStart":330,"responseEnd":365,"domLoading":334,"domInteractive":1115,"domContentLoadedEventStart":1115,"domContentLoadedEventEnd":1154,"domComplete":1534,"loadEventStart":1534,"loadEventEnd":1534,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1085.1000003814697},{"name":"bigPipe.sidebar-id.end","time":1085.8000001907349},{"name":"bigPipe.activity-panel-pipe-id.start","time":1086},{"name":"bigPipe.activity-panel-pipe-id.end","time":1087.1000003814697},{"name":"activityTabFullyLoaded","time":1170.9000000953674}],"measures":[],"correlationId":"e17c6b965fd29f","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":105,"dbReadsTimeInMs":22,"dbConnsTimeInMs":33,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Thanks to wlad for the idea, and for further optimization suggestions.