MySQL Variables table_open_cache_instances 数据库 参数变量解释及正确配置使用

本站中文解释

MySQL参数table_open_cache_instances的用途是控制每个实例可以打开的表的数量。当table_cache设置的值过大时,可以通过设置table_open_cache_instances来将表数量分割到每个实例,从而减少某个实例表数量变得过大而占用资源、影响性能的问题。

设置方法:
– 通过MySQL命令行窗口:
set global table_open_cache_instances=Value;

– 通过MySQL配置文件参数来设置:
table_open_cache_instances=Value

官方英文解释

table_open_cache_instances

Command-Line Format --table-open-cache-instances=#
System Variable table_open_cache_instances
Scope Global
Dynamic No
Type Integer
Default Value 16
Minimum Value 1
Maximum Value 64

The number of open tables cache instances. To improve
scalability by reducing contention among sessions, the open
tables cache can be partitioned into several smaller cache
instances of size
table_open_cache /
table_open_cache_instances .
A session needs to lock only one instance to access it for DML
statements. This segments cache access among instances,
permitting higher performance for operations that use the
cache when there are many sessions accessing tables. (DDL
statements still require a lock on the entire cache, but such
statements are much less frequent than DML statements.)

A value of 8 or 16 is recommended on systems that routinely
use 16 or more cores. However, if you have many large triggers
on your tables that cause a high memory load, the default
setting for
table_open_cache_instances
might lead to excessive memory usage. In that situation, it
can be helpful to set
table_open_cache_instances to
1 in order to restrict memory usage.


数据运维技术 » MySQL Variables table_open_cache_instances 数据库 参数变量解释及正确配置使用