8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

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

20.7.6 XCom 缓存管理20.7.6 XCom Cache Management

组复制的组通信引擎(XCom,一种 Paxos 变体)包含一个用于缓存消息(及其元数据)的缓存,该消息在组成员之间作为共识协议的一部分进行交换。除了其他功能之外,消息缓存还用于那些在一段时间内无法与其他组成员通信而重新连接到组的成员恢复丢失的消息。The group communication engine for Group Replication (XCom, a Paxos variant) includes a cache for messages (and their metadata) exchanged between the group members as a part of the consensus protocol. Among other functions, the message cache is used for recovery of missed messages by members that reconnect with the group after a period where they were unable to communicate with the other group members.

可以使用 group_replication_message_cache_size 系统变量为 XCom 的消息缓存设置缓存大小限制。如果达到缓存大小限制,XCom 会删除已决定并已发送的最旧条目。应在所有组成员上设置相同的缓存大小限制,因为尝试重新连接的无法访问的成员会随机选择其他成员来恢复丢失的消息。因此,每个成员的缓存中应有相同的消息。A cache size limit can be set for XCom's message cache using the group_replication_message_cache_size system variable. If the cache size limit is reached, XCom removes the oldest entries that have been decided and delivered. The same cache size limit should be set on all group members, because an unreachable member that is attempting to reconnect selects any other member at random for recovery of missed messages. The same messages should therefore be available in each member's cache.

确保系统中有足够的内存以支持所选的缓存大小限制,同时考虑 MySQL 服务器的其他缓存和对象池的大小。请注意,使用 group_replication_message_cache_size 设置的限制仅适用于存储在缓存中的数据,而缓存结构还需要额外的 50 MB 内存。Ensure that sufficient memory is available on your system for your chosen cache size limit, considering the size of MySQL Server's other caches and object pools. Note that the limit set using group_replication_message_cache_size applies only to the data stored in the cache, and the cache structures require an additional 50 MB of memory.

在选择 group_replication_message_cache_size 的值时,应考虑在成员被驱逐之前预期的消息量。这个周期的长度由 group_replication_member_expel_timeout 系统变量控制,该变量决定允许成员返回群组而不被驱逐的等待时间(最长可达一小时),在最初 5 秒的检测期之外。超时时间默认值为 5 秒,因此默认情况下,成员只有在缺席至少 10 秒后才会被驱逐。When choosing the value for group_replication_message_cache_size, do so with regard to the expected volume of messages in the period before a member is expelled. The length of this period is controlled by the group_replication_member_expel_timeout system variable, which determines the waiting period (up to an hour) that is allowed in addition to the initial 5-second detection period for members to return to the group rather than being expelled. The timeout defaults to 5 seconds, so by default a member is not expelled until it has been absent for at least 10 seconds.