The documentation says that the thread_cache_size system variable supports auto-sizing in MariaDB 10.2 and later, and that auto-sizing is the default:
From MariaDB 10.2.0, the default is automatically set to the smaller of either 256, or the max_connections size.
|
https://mariadb.com/kb/en/library/server-system-variables/#thread_cache_size
However, this does not seem to be the case. This system variable does not support AUTO_SET, and the default is 256:
static Sys_var_ulong Sys_thread_cache_size(
|
"thread_cache_size",
|
"How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time",
|
GLOBAL_VAR(thread_cache_size), CMD_LINE(REQUIRED_ARG),
|
VALID_RANGE(0, 16384), DEFAULT(256), BLOCK_SIZE(1));
|
https://github.com/MariaDB/server/blob/mariadb-10.4.6/sql/sys_vars.cc#L3655
The only time that this system variable appears to be auto-sized is if its configured value is greater than max_connections:
/* Ensure that some variables are not set higher than needed */
|
if (thread_cache_size > max_connections)
|
SYSVAR_AUTOSIZE(thread_cache_size, max_connections);
|
https://github.com/MariaDB/server/blob/mariadb-10.4.6/sql/mysqld.cc#L9013
Is this a documentation bug, or is the behavior of thread_cache_size incorrect?
{"report":{"fcp":834.5,"ttfb":227.10000038146973,"pageVisibility":"visible","entityId":77105,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"fc4fa054-1ebf-439c-887a-579b913edfda","navigationType":0,"readyForUser":899,"redirectCount":0,"resourceLoadedEnd":522.6000003814697,"resourceLoadedStart":232.69999980926514,"resourceTiming":[{"duration":24.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":232.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":232.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":257.19999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":24.800000190734863,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":232.89999961853027,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":232.89999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":257.69999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":167.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":233.19999980926514,"connectEnd":233.19999980926514,"connectStart":233.19999980926514,"domainLookupEnd":233.19999980926514,"domainLookupStart":233.19999980926514,"fetchStart":233.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":261.19999980926514,"responseEnd":401,"responseStart":278.30000019073486,"secureConnectionStart":233.19999980926514},{"duration":249.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/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":233.30000019073486,"connectEnd":260.6000003814697,"connectStart":260.6000003814697,"domainLookupEnd":260.6000003814697,"domainLookupStart":260.6000003814697,"fetchStart":233.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":261,"responseEnd":482.5,"responseStart":275.8999996185303,"secureConnectionStart":260.6000003814697},{"duration":45.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":233.5,"connectEnd":233.5,"connectStart":233.5,"domainLookupEnd":233.5,"domainLookupStart":233.5,"fetchStart":233.5,"redirectEnd":0,"redirectStart":0,"requestStart":262,"responseEnd":279.30000019073486,"responseStart":277.6000003814697,"secureConnectionStart":233.5},{"duration":53.19999980926514,"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":233.60000038146973,"connectEnd":233.60000038146973,"connectStart":233.60000038146973,"domainLookupEnd":233.60000038146973,"domainLookupStart":233.60000038146973,"fetchStart":233.60000038146973,"redirectEnd":0,"redirectStart":0,"requestStart":269.69999980926514,"responseEnd":286.80000019073486,"responseStart":285.19999980926514,"secureConnectionStart":233.60000038146973},{"duration":83.5,"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":233.80000019073486,"connectEnd":233.80000019073486,"connectStart":233.80000019073486,"domainLookupEnd":233.80000019073486,"domainLookupStart":233.80000019073486,"fetchStart":233.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":275.6000003814697,"responseEnd":317.30000019073486,"responseStart":316.19999980926514,"secureConnectionStart":233.80000019073486},{"duration":35,"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":234,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":234,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":269,"responseStart":0,"secureConnectionStart":0},{"duration":60.90000057220459,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":234.19999980926514,"connectEnd":234.19999980926514,"connectStart":234.19999980926514,"domainLookupEnd":234.19999980926514,"domainLookupStart":234.19999980926514,"fetchStart":234.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":276.80000019073486,"responseEnd":295.1000003814697,"responseStart":292.69999980926514,"secureConnectionStart":234.19999980926514},{"duration":38.59999942779541,"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":234.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":234.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":272.8999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":63.60000038146973,"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":234.5,"connectEnd":234.5,"connectStart":234.5,"domainLookupEnd":234.5,"domainLookupStart":234.5,"fetchStart":234.5,"redirectEnd":0,"redirectStart":0,"requestStart":277,"responseEnd":298.1000003814697,"responseStart":293.30000019073486,"secureConnectionStart":234.5},{"duration":210.30000019073486,"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":240.19999980926514,"connectEnd":240.19999980926514,"connectStart":240.19999980926514,"domainLookupEnd":240.19999980926514,"domainLookupStart":240.19999980926514,"fetchStart":240.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":306.3999996185303,"responseEnd":450.5,"responseStart":446.6000003814697,"secureConnectionStart":240.19999980926514},{"duration":282.4000005722046,"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":240.19999980926514,"connectEnd":240.19999980926514,"connectStart":240.19999980926514,"domainLookupEnd":240.19999980926514,"domainLookupStart":240.19999980926514,"fetchStart":240.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":339.8999996185303,"responseEnd":522.6000003814697,"responseStart":519.6000003814697,"secureConnectionStart":240.19999980926514},{"duration":200.30000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":604.3999996185303,"connectEnd":604.3999996185303,"connectStart":604.3999996185303,"domainLookupEnd":604.3999996185303,"domainLookupStart":604.3999996185303,"fetchStart":604.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":773.3000001907349,"responseEnd":804.6999998092651,"responseStart":804,"secureConnectionStart":604.3999996185303}],"fetchStart":0,"domainLookupStart":30,"domainLookupEnd":36,"connectStart":36,"connectEnd":55,"secureConnectionStart":44,"requestStart":55,"responseStart":227,"responseEnd":236,"domLoading":231,"domInteractive":952,"domContentLoadedEventStart":952,"domContentLoadedEventEnd":992,"domComplete":1424,"loadEventStart":1424,"loadEventEnd":1425,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":933.3999996185303},{"name":"bigPipe.sidebar-id.end","time":934.1999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":934.3999996185303},{"name":"bigPipe.activity-panel-pipe-id.end","time":935.1000003814697},{"name":"activityTabFullyLoaded","time":1005.5}],"measures":[],"correlationId":"cf21c024fbb37a","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":97,"dbReadsTimeInMs":12,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Looks like a documentation bug. It didn't do "smaller of either 256, or the max_connections size" even in 10.2.0