MySQL Variables thread_pool_stall_limit 数据库 参数变量解释及正确配置使用
本站中文解释
和thread_pool_priority
MySQL参数变量thread_pool_stall_limit和thread_pool_priority是MySQL8.0版本后引入的新参数,用于配置MySQL线程池。
thread_pool_stall_limit参数控制MySQL线程池线程阻塞时间的阈值,当线程池某一线程等待时间超过该指定的值时,会出现阻塞状态,线程池定期对已处于等待状态的线程以最高优先级处理,让其得到更多处理时间。该参数可接收int类型数值,默认值是600,单位为毫秒。
thread_pool_priority参数可以指定mysql线程池线程的优先级,可取的值有low、normal和high,low代表低优先级,high代表高优先级,默认值为normal,指定线程优先级便于MySQL管理线程池,从而提升系统的处理效率。
要设置MySQL参数变量thread_pool_stall_limit和thread_pool_priority,可以使用如下语句:
SET GLOBAL thread_pool_stall_limit=600;
SET GLOBAL thread_pool_priority=normal;
官方英文解释
thread_pool_stall_limit
Command-Line Format | --thread-pool-stall-limit=# |
---|---|
System Variable | thread_pool_stall_limit |
Scope | Global |
Dynamic | Yes |
Type | Integer |
Default Value | 6 |
Minimum Value | 4 |
Maximum Value | 600 |
Unit | milliseconds * 10 |
This variable affects executing statements. The value is the
amount of time a statement has to finish after starting to
execute before it becomes defined as stalled, at which point
the thread pool permits the thread group to begin executing
another statement. The value is measured in 10 millisecond
units, so the default of 6 means 60ms. Short wait values
permit threads to start more quickly. Short values are also
better for avoiding deadlock situations. Long wait values are
useful for workloads that include long-running statements, to
avoid starting too many new statements while the current ones
execute.
This variable is available only if the thread pool plugin is
enabled. See Section 5.5.3, “MySQL Enterprise Thread Pool”.