table_open_cache increase issue - MariaDB 10.2
-
29-12-2020 - |
Frage
I'm trying to increase to 9000 but MariaDB sets it at 4895 automatically.
Here is my simple config https://pastebin.com/raw/4eFiuFSv
MySQLTuner output:
Control warning line(s) into /var/lib/mysql/cp.goal.ge.err file
Control error line(s) into /var/lib/mysql/cp.goal.ge.err file
Restrict Host for user@% to user@SpecificDNSorIp
Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
Temporary table size is already large - reduce result set size
Reduce your SELECT DISTINCT queries without LIMIT clauses
Increase table_open_cache gradually to avoid file descriptor limits
Read this before increasing table_open_cache over 64:
Beware that open_files_limit (10000) variable
should be greater than table_open_cache (4895)
Optimize queries and/or use InnoDB to reduce lock wait
Consider installing Sys schema from https://github.com/mysql/mysql-sys
Variables to adjust:
query_cache_size (=0)
query_cache_type (=0)
query_cache_size (> 125M)
table_open_cache (> 4895)
Lösung
I can see 3 different reasons why MariaDB might reset this variable. In order of most to least likely explanation:
- You have another .cnf file where the
table_open_cache
variable is being set to 4895. - The MariaDB Systemd unit file (or SysV init script on older Linux versions) is overwriting the variable value you've set.
- You're running a non-standard MariaDB server that's been compiled with a hard-coded value for
table_open_cache
. (Unlikely!)
Additionally, it's possible that another software (such as cPanel) might change the variable dynamically after MariaDB has started.
To see which options the MariaDB server will get from the option files, run:
mysqld --print-defaults
To find all the places where the MariaDB server is looking for .cnf files, run:
mysqld --verbose --help | grep -A 1 'Default options are read'
You can then grep
each of these files to see if you find any instances of table_open_cache
or table-open-cache
.
For reference, you should be able to see the current value of the variable with:
show global variables like 'table_open_cache';
And you may also want to consult this page in the MariaDB Knowledge Base: Optimizing table_open_cache.