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

本站中文解释

thread_pool_algorithm参数是MySQL 8.0中新增的参数,该参数控制MySQL线程池使用的调度算法。该参数支持三种策略:RR(轮询调度)、OS(操作系统)和TS(目标调度)。

轮询调度是最常用的调度算法,它将每个线程分配到来自指定队列的任务,这样每个线程都可以进行任务处理。

操作系统调度使用操作系统底层的调度算法,即如果线程池中有任务来了,则操作系统将根据实施的调度算法为每个线程分配一个任务,以保证一致的线程分配。

目标调度用于处理更大的线程池,它将多个任务全部分配到不同队列中,并将增量部分分配给所有队列,以保持均衡性。

要设置thread_pool_algorithm参数,可以使用以下指令:
SET GLOBAL thread_pool_algorithm=;

官方英文解释

thread_pool_algorithm

Command-Line Format --thread-pool-algorithm=#
System Variable thread_pool_algorithm
Scope Global
Dynamic No
Type Integer
Default Value 0
Minimum Value 0
Maximum Value 1

This variable controls which algorithm the thread pool plugin
uses:

  • A value of 0 (the default) uses a conservative
    low-concurrency algorithm which is most well tested and is
    known to produce very good results.

  • A value of 1 increases the concurrency and uses a more
    aggressive algorithm which at times has been known to
    perform 5–10% better on optimal thread counts, but
    has degrading performance as the number of connections
    increases. Its use should be considered as experimental
    and not supported.

This variable is available only if the thread pool plugin is
enabled. See Section 5.5.3, “MySQL Enterprise Thread Pool”.


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