什么时候应该使用MySQL压缩协议? [英] When should I use MySQL compressed protocol?

查看:165
本文介绍了什么时候应该使用MySQL压缩协议?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道MySQL可以压缩服务器和客户端之间的通信。

I've learned that MySQL can compress communication between servers and clients.


如果客户端和
都使用压缩服务器支持zlib压缩和
客户端请求压缩。

Compression is used if both client and server support zlib compression, and the client requests compression.

(来自 MySQL Forge Wiki

优点和缺点


  • 优点:减少有效负载大小

  • cons:增加计算时间

所以,是压缩协议,我应该启用,只要我能负担得起服务器具有足够的规格?是否还有其他因素我应该考虑?

So, is compressed protocol something I should enable whenever I can afford servers with adequate specs? Are there other factors I should consider?

推荐答案

性能优势将在很大程度上取决于结果集的大小,除了数据库服务器及其客户端之间的网络带宽和延迟之外,还在发送。

Performance benefits are going to be largely dependent on the size of the result sets that you are sending, in addition to the network bandwidth and latency between the database server and its clients.

结果集越大,延迟时间越长,您越有可能看到压缩的好处。

The larger the result sets, the larger the latency, or the less bandwidth, the more likely you will see the benefit of compression.

您的最高服务水平限于最小的瓶颈。因此,您需要分析您当前在网络和CPU资源方面的情况。

Your maximum level of service is limited to the smallest bottleneck. So, you need to analyze where you're currently at regarding network and CPU resources.

最优化的数据库服务器100%的时间利用其CPU的100%否则你通过使一个处理器坐在那里不做任何事情,浪费了计算资源。当然,你不希望它在101%,所以你的目标范围是远低于100%。然而,我的观点是,如果你在达到CPU瓶颈之前有很多余量,并且结果集是一个重要的大小,网络是一个因素,然后打开压缩。

The most optimized database server utilizes 100% of its CPU 100% of the time, otherwise you're wasting computing resources by having a processor that's sitting there not doing anything. Of course, you don't want it at 101%, so your target range is well below 100%. Yet, my point is that if you have a lot of headroom before you reach a CPU bottleneck, and the result sets are a significant size, and the network is a factor, then turn compression on. CPU cycles are cheap, especially unused ones (you do pay for electricity and cooling).

如果您支付带宽,交易CPU使用带宽是容易合理的,甚至,如果你不在任何地方接近带宽瓶颈,更快的速度和更高的服务水平,是值得的。

If you pay for bandwidth, trading CPU usage for bandwidth is easily justified, and even if you're not anywhere near reaching the bandwidth bottleneck, that faster speed, and higher level of service, is worth something.

不要忘记客户也必须消耗CPU周期来解压缩数据。不是一个大问题,但仍是一个因素。一般来说,今天的CPU比现在的网络更快。

Don't forget that the client must also expend CPU cycles to decompress the data. Not a major issue, but still a factor. In general, today's CPUs are faster than today's networks.

这篇关于什么时候应该使用MySQL压缩协议?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆