前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >MySQL中 slave_compressed_protocol=ON 的压缩效果实验

MySQL中 slave_compressed_protocol=ON 的压缩效果实验

作者头像
保持热爱奔赴山海
发布2019-09-17 14:42:19
9520
发布2019-09-17 14:42:19
举报
文章被收录于专栏:数据库相关

实验环境:CentOS7.5、MySQL5.7

主库:

set global slave_compressed_protocol = ON ;

slave1上,设置压缩:

set global slave_compressed_protocol = ON ;

stop slave io_thread ; 

start slave io_thread ;  -- 注意,这个修改后,需要重启下 io线程

image.png
image.png
image.png
image.png

slave2上,不设置压缩(默认情况下MySQL就是不压缩的):

image.png
image.png
image.png
image.png

下图,是主库在2种情况下的网卡流量情况

开启压缩的时候,最大约7.14MB/s

image.png
image.png

不开启压缩的情况下,最高约23.76MB/s

image.png
image.png

可以看到,开启slave_compressed_protocol=ON 后,带宽得到了很大的压缩(节省了2/3的带宽),在跨机房同步的时候,可以避免专线的过高占用。

注意: 开启压缩,在一定程度上是会消耗CPU资源,因此,如果数据库机器的CPU负载已经很高了,就不太建议再开压缩了。

这篇文档的图片更直观些:https://blog.pythian.com/masterslave-replication-in-limited-bandwidth-scenarios/

官方文档:

    https://dev.mysql.com/doc/refman/5.7/en/replication-options-slave.html

    Whether to use compression of the slave/master protocol if both the slave and the master support it. The default is that compression is not used. Changes to this variable take effect on subsequent connection attempts; this includes after issuing a START SLAVE statement, as well as reconnections made by a running I/O thread (for example after issuing a CHANGE MASTER TO MASTER_RETRY_COUNT statement).

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/04/03 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档