ITPub博客

首页 > 数据库 > MySQL > mgr-核心参数-group_replication_transaction_size_limit

mgr-核心参数-group_replication_transaction_size_limit

原创 MySQL 作者:贺子_DBA时代 时间:2023-12-10 21:22:03 0 删除 编辑
一、官方文档解释:
0
This system variable should have the same value on all group members. The value of this system variable can be changed while Group Replication is running. The change takes effect immediately on the group member, and applies from the next transaction started on that member. During this process, the value of the system variable is permitted to differ between group members, but some transactions might be rejected.
该系统变量在所有组成员上都应具有相同的值。当组复制正在运行时,可以更改此系统变量的值。更改将立即在组成员上生效,并从该成员上启动的下一个事务开始应用。在此过程中,允许组成员之间的系统变量值不同,但某些事务可能会被拒绝。
group_replication_transaction_size_limit configures the maximum transaction size in bytes which the replication group accepts. Transactions larger than this size are rolled back by the receiving member and are not broadcast to the group. Large transactions can cause problems for a replication group in terms of memory allocation, which can cause the system to slow down, or in terms of network bandwidth consumption, which can cause a member to be suspected of having failed because it is busy processing the large transaction.
group_replication_transaction_size_limit配置复制组接受的最大事务大小(以字节为单位)。 大于此大小的事务由接收成员回滚,并且不向组广播。大型事务可能会在内存使用(分配)方面给复制组带来问题,这可能会导致系统速度减慢,或者在网络带宽消耗方面,这可能导致成员因忙于处理大型事务而被怀疑失败。
When this system variable is set to 0 there is no limit to the size of transactions the group accepts. From MySQL 8.0, the default setting for this system variable is 150000000 bytes (approximately 143 MB). Adjust the value of this system variable depending on the maximum message size that you need the group to tolerate(容忍), bearing in mind that the time taken to process a transaction is proportional to its size. The value of group_replication_transaction_size_limit should be the same on all group members. For further mitigation strategies for large transactions, see Section 18.3.2, “Group Replication Limitations”.
当此系统变量设置为0时,组接受的事务大小没有限制。在MySQL 8.0中,此系统变量的默认设置为150000000字节(约143MB)。根据您需要组允许的最大消息大小调整此系统变量的值,请记住处理事务所需的时间与其大小成正比。group_replication_transaction_size_limit的值在所有组成员上都应相同。有关大型事务的进一步缓解策略,请参阅第18.3.2节“组复制限制”。
二、个人理解:
1)该参数只对会对本节点有效果,如果mgr集群多个节点该参数配置不同,例如接受事务的节点设置的比较大,其余节点比较小,可能会导致参数值小的节点拒绝这个事务,进而导致该事务失败(取决于mgr集群配置组复制参数group_replication_consistency的配置);
2)该参数设置需要结合mgr flow control相关参数一块设置,因为如果单个事务太大,可能由于该事务执行太长,又由于mgr事务全局一致性,如果某个事务不能并发应用,那么该事务后面的事务需要等待这个事务执行完毕,来保证事务的顺序,这样就会导致队列中挤压事务,进而可能出发mgr流控;

3) 大事务可能导致节点被剔除 mgr心跳检测时间为5秒,固定值,无法修改;集群中每个节点都会定期(每秒 1 次)向其它节点发送心跳信息。如果在 5s 内(固定值,无参数调整)没有收到其它节点的心跳信息,则会将该节点标记为可疑节点,同时会将该节点的状态设置为 UNREACHABLE 。如果集群中有等于或超过 1/2 的节点显示为 UNREACHABLE ,则该集群不能对外提供写服务!

如果一个事务非常大,binlog非常大,导致节点间网络带宽消耗太大,以至于无法在 5 秒内无法完成心跳检测,这时会将该节点标记为可疑节点。要避免该问题,可以尽可能地限制事务的大小;
4)该限制只会接收事务的节点commit时报错,事务执行过程中即使超过阈值也无感知。
三、参数设置建议:
根据业务场景合理设置group_replication_transaction_size_limit:
1、对于安全级别比较高的系统,建议设置group_replication_transaction_size_limit比较小的值,保持默认,或者更小的值;
2、对于业务中有大事务的场景不建议使用mgr,如果必须是哦也能够mgr,可以调大group_replication_member_expel_timeout这个参数,并且调大group_replication_message_cache_size,然后调大group_replication_transaction_size_limit参数;


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29654823/viewspace-2999469/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
10年数据库管理员从业经历,熟悉Oracle、mysql、tidb、oceanbase、redis、 mongodb 、python等技术栈,持有11g ocm 、mysql 5.7 ocp 、tidb 5.0 ptcp、tidb 6.0 ptca、oceanbase obcp等

注册时间:2014-05-12

  • 博文量
    327
  • 访问量
    2148994