17.9.7.2 Message Compression

For messages sent between online group members, Group
Replication enables message compression by default. Whether a
specific message is compressed depends on the threshold that you
configure using the
group_replication_compression_threshold
system variable. Messages that have a payload larger than the
specified number of bytes are compressed.

The default compression threshold is 1000000 bytes. You could
use the following statements to increase the compression
threshold to 2MB, for example:

Group Replication uses the LZ4 compression algorithm to compress
messages sent in the group. Note that the maximum supported
input size for the LZ4 compression algorithm is 2113929216
bytes. This limit is lower than the maximum possible value for
the
group_replication_compression_threshold
system variable, which is matched to the maximum message size
accepted by XCom. The LZ4 maximum input size is therefore a
practical limit for message compression, and transactions above
this size cannot be committed when message compression is
enabled. With the LZ4 compression algorithm, do not set a value
greater than 2113929216 bytes for
group_replication_compression_threshold.

The value of
group_replication_compression_threshold
is not required by Group Replication to be the same on all group
members. However, it is advisable to set the same value on all
group members in order to avoid unnecessary rollback of
transactions, failure of message delivery, or failure of message
recovery.

Compression for messages sent in the group happens at the group
communication engine level, before the data is handed over to
the group communication thread, so it takes place within the
context of the mysql user session thread. If
the message payload size exceeds the threshold set by
group_replication_compression_threshold,
the transaction payload is compressed before being sent out to
the group, and decompressed when it is received. Upon receiving
a message, the member checks the message envelope to verify
whether it is compressed or not. If needed, then the member
decompresses the transaction, before delivering it to the upper
layer. This process is shown in the following figure.

Figure 17.15 Compression Support

When network bandwidth is a bottleneck, message compression can
provide up to 30-40% throughput improvement at the group
communication level. This is especially important within the
context of large groups of servers under load. The TCP
peer-to-peer nature of the interconnections between
N participants in the group makes the
sender send the same amount of data N
times. Furthermore, binary logs are likely to exhibit a high
compression ratio. This makes compression a compelling feature
for Group Replication workloads that contain large transactions.