Users can configure the number of purge threads to use.
Currently, the existing logic looks at the increasing history length and accordingly increases the purge threads (respecting the user-set threshold). User active user workload causes history length to increase that, in turn, leads to more purge threads to get scheduled.
Purge operation generates redo-records in addition to user workload redo-records. This dual redo generations cause intense pressure on redo-log which can easily cause redo-log to hit the threshold and there-by-causing jitter in overall throughput (including furious flushing).
In order to improve the user workload performance and it is important to ensure background activity like a purge is not overdone while ensuring history length is kept in check to avoid an increase in select latency.
The proposed patch explores an adaptive purge thread scheduling approach based on the redo log fill factor. Logic tends to dynamically increase or decrease the purge threads based on how much redo log is filled, leaving enough space/resources/flush bandwidth for the user workload.
Testing done so far has revealed quite encouraging results especially with slower disk where-in flush is unable to catch up with redo log generation rate. Increasing in history length doesn't tend to have a regressing effect on the queries.
{"report":{"fcp":1009.0999999046326,"ttfb":185,"pageVisibility":"visible","entityId":101929,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"3e0eb264-8c2e-4c24-983d-08e4d15cab96","navigationType":0,"readyForUser":1108,"redirectCount":0,"resourceLoadedEnd":1218.5,"resourceLoadedStart":190.59999990463257,"resourceTiming":[{"duration":286.40000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":190.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":190.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":477,"responseStart":0,"secureConnectionStart":0},{"duration":286.40000009536743,"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":190.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":190.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":477.30000019073486,"responseStart":0,"secureConnectionStart":0},{"duration":295.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":191.09999990463257,"connectEnd":191.09999990463257,"connectStart":191.09999990463257,"domainLookupEnd":191.09999990463257,"domainLookupStart":191.09999990463257,"fetchStart":191.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":191.09999990463257,"responseEnd":486.5,"responseStart":486.5,"secureConnectionStart":191.09999990463257},{"duration":372.30000019073486,"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":191.19999980926514,"connectEnd":191.19999980926514,"connectStart":191.19999980926514,"domainLookupEnd":191.19999980926514,"domainLookupStart":191.19999980926514,"fetchStart":191.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":191.19999980926514,"responseEnd":563.5,"responseStart":563.5,"secureConnectionStart":191.19999980926514},{"duration":375.80000019073486,"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":191.5,"connectEnd":191.5,"connectStart":191.5,"domainLookupEnd":191.5,"domainLookupStart":191.5,"fetchStart":191.5,"redirectEnd":0,"redirectStart":0,"requestStart":191.5,"responseEnd":567.3000001907349,"responseStart":567.3000001907349,"secureConnectionStart":191.5},{"duration":376.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":191.59999990463257,"connectEnd":191.59999990463257,"connectStart":191.59999990463257,"domainLookupEnd":191.59999990463257,"domainLookupStart":191.59999990463257,"fetchStart":191.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":191.59999990463257,"responseEnd":567.8000001907349,"responseStart":567.8000001907349,"secureConnectionStart":191.59999990463257},{"duration":376.2999997138977,"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":191.80000019073486,"connectEnd":191.80000019073486,"connectStart":191.80000019073486,"domainLookupEnd":191.80000019073486,"domainLookupStart":191.80000019073486,"fetchStart":191.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":191.80000019073486,"responseEnd":568.0999999046326,"responseStart":568.0999999046326,"secureConnectionStart":191.80000019073486},{"duration":438.19999980926514,"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":192,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":192,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":630.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":376.40000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":192.09999990463257,"connectEnd":192.09999990463257,"connectStart":192.09999990463257,"domainLookupEnd":192.09999990463257,"domainLookupStart":192.09999990463257,"fetchStart":192.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":192.09999990463257,"responseEnd":568.5,"responseStart":568.5,"secureConnectionStart":192.09999990463257},{"duration":438,"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":192.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":192.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":630.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":376.59999990463257,"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":192.40000009536743,"connectEnd":192.40000009536743,"connectStart":192.40000009536743,"domainLookupEnd":192.40000009536743,"domainLookupStart":192.40000009536743,"fetchStart":192.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":192.40000009536743,"responseEnd":569,"responseStart":569,"secureConnectionStart":192.40000009536743},{"duration":513.8999996185303,"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":193.80000019073486,"connectEnd":193.80000019073486,"connectStart":193.80000019073486,"domainLookupEnd":193.80000019073486,"domainLookupStart":193.80000019073486,"fetchStart":193.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":193.80000019073486,"responseEnd":707.6999998092651,"responseStart":707.6999998092651,"secureConnectionStart":193.80000019073486},{"duration":993.5999999046326,"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":198.30000019073486,"connectEnd":198.30000019073486,"connectStart":198.30000019073486,"domainLookupEnd":198.30000019073486,"domainLookupStart":198.30000019073486,"fetchStart":198.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":198.30000019073486,"responseEnd":1191.9000000953674,"responseStart":1191.9000000953674,"secureConnectionStart":198.30000019073486},{"duration":118,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":642.5999999046326,"connectEnd":642.5999999046326,"connectStart":642.5999999046326,"domainLookupEnd":642.5999999046326,"domainLookupStart":642.5999999046326,"fetchStart":642.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":642.5999999046326,"responseEnd":760.5999999046326,"responseStart":760.5,"secureConnectionStart":642.5999999046326},{"duration":295.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/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&whisper-enabled=true","startTime":922.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":922.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1218.5,"responseStart":0,"secureConnectionStart":0},{"duration":341.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/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&whisper-enabled=true","startTime":923.5999999046326,"connectEnd":923.5999999046326,"connectStart":923.5999999046326,"domainLookupEnd":923.5999999046326,"domainLookupStart":923.5999999046326,"fetchStart":923.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":923.5999999046326,"responseEnd":1264.9000000953674,"responseStart":1264.9000000953674,"secureConnectionStart":923.5999999046326},{"duration":347,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/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&whisper-enabled=true","startTime":924.0999999046326,"connectEnd":924.0999999046326,"connectStart":924.0999999046326,"domainLookupEnd":924.0999999046326,"domainLookupStart":924.0999999046326,"fetchStart":924.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":924.0999999046326,"responseEnd":1271.0999999046326,"responseStart":1271.0999999046326,"secureConnectionStart":924.0999999046326}],"fetchStart":1,"domainLookupStart":1,"domainLookupEnd":1,"connectStart":1,"connectEnd":1,"requestStart":14,"responseStart":185,"responseEnd":190,"domLoading":188,"domInteractive":1235,"domContentLoadedEventStart":1235,"domContentLoadedEventEnd":1286,"domComplete":1833,"loadEventStart":1833,"loadEventEnd":1834,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1194.5},{"name":"bigPipe.sidebar-id.end","time":1195.5},{"name":"bigPipe.activity-panel-pipe-id.start","time":1195.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.end","time":1198.1999998092651},{"name":"activityTabFullyLoaded","time":1310.5999999046326}],"measures":[],"correlationId":"fa3c54f8b70ca7","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":113,"dbReadsTimeInMs":19,"dbConnsTimeInMs":29,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
I reran bench.sh from adaptive_purge.tar.gz
on the SATA SSD, with innodb_log_file_size=10g and innodb_buffer_pool_size=40g (and 12GiB of data files). The previous run should correspond to the file patched-ssd40.txt inside the archive. In adaptive_purge.gnumeric
I think that this corresponds to the tab "SSD 40G/40G". In that data, we can see a few 5-second intervals where the throughput dropped to 0, both for the baseline and the originally tested patch.
With my experimental revert in
.
MDEV-32050, I see no intervals of 0tps, but the average and maximum throughput were in the worst case dropping to half, in the best case doubled. It is possible thatMDEV-26827andMDEV-26055as well as the other changes inMDEV-32050have contributed to this. I attached the raw log from this experiment as patched2-ssd40.txt