Group Replication now interacts with the Group Communication Engine more efficiently

MySQL 8.0.14 comes with a plethora of new features. Some of the new Group Replication features have userfacing options, some impact user-facing options, and others stay completely under the hood. This post will present one of the under-the-hood changes in MySQL 8.0.14: the way the Group Replication layer interacts with the underlying Group Communication Engine layer, XCom.

Figure 1 shows a diagram of the Group Replication architecture.

The Group Replication architecture
Figure 1: The Group Replication architecture.

Each group member is running a MySQL server instance making use of the Group Replication plugin. The plugin itself is built atop XCom, which provides a group communication service to Group Replication via the Group Communication System API (GCS). For example, GCS provides a group with dynamic membership and total-order broadcast of messages within the group.

Before MySQL 8.0.14, when Group Replication interacted with its local XCom instance via GCS, that interaction took place through XCom’s TCP socket. The same socket that the local XCom instance uses to communicate with the XCom instances of other group members. You know, the one you configure using the group_replication_local_address system variable.

Using the XCom’s TCP socket to interact with the local XCom instance had the benefit of code simplicity and uniformity, since the way GCS interacted with a local or remote XCom was the same. However, using the socket had some drawbacks, such as:

  • (De)serialization of requests, and
  • Memory copying throughout the network stack.

In MySQL 8.0.14, like Figure 2 depicts, GCS uses a shared-memory queue to interact with its local XCom instance instead of the TCP socket. Using the shared-memory queue allows GCS to do away with the aforementioned drawbacks, since they were a consequence of using networking mechanisms to interact with the local XCom instance.

 In MySQL 8.0.14, the Group Communication System API uses a shared-memory queue to interact with the underlying XCom instance.
Figure 2: In MySQL 8.0.14, the Group Communication System API uses a shared-memory queue to interact with the underlying XCom instance.

For those of you interested in the more low-level details, the shared-memory queue is a concurrent, multi-producer, single-consumer queue implemented using C++11 atomics.

MySQL 8.0.14 is out, give it a spin and let us know what you think.

4,316 total views, 2 views today

Leave a Reply