8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

20.7.1 微调组通信线程20.7.1 Fine Tuning the Group Communication Thread

当加载 Group Replication 插件时,组通信线程 (GCT) 会循环运行。GCT 接收来自组和插件的消息,处理与法定票数和故障检测相关的任务,发送一些保持活动的消息,并处理来自/发送到服务器/组的传入和传出事务。GCT 在队列中等待传入消息。当没有消息时,GCT 会等待。通过将此等待配置得稍微长一些(进行主动等待)然后再真正进入休眠状态,在某些情况下可能会带来好处。这是因为另一种情况是操作系统将 GCT 从处理器中切换出去并执行上下文切换。The group communication thread (GCT) runs in a loop while the Group Replication plugin is loaded. The GCT receives messages from the group and from the plugin, handles quorum and failure detection related tasks, sends out some keep alive messages and also handles the incoming and outgoing transactions from/to the server/group. The GCT waits for incoming messages in a queue. When there are no messages, the GCT waits. By configuring this wait to be a little longer (doing an active wait) before actually going to sleep can prove to be beneficial in some cases. This is because the alternative is for the operating system to switch out the GCT from the processor and do a context switch.

要强制 GCT 执行主动等待,请使用 group_replication_poll_spin_loops 选项,这会让 GCT 循环,做与配置的循环次数无关的操作,然后再真正轮询队列获取下一个消息。To force the GCT to do an active wait, use the group_replication_poll_spin_loops option, which makes the GCT loop, doing nothing relevant for the configured number of loops, before actually polling the queue for the next message.

例如:For example:

mysql> SET GLOBAL group_replication_poll_spin_loops= 10000;