简体   繁体   English

Kafka生产者和经纪人压缩

[英]Kafka producer and broker compression

If Kafka producer compression is set (eg to gzip), and the broker configuration is also set to the same codec, will the broker re-compress any messages from the producer, or recognise that its the same codec and skip and broker-side re-compression?如果设置了 Kafka 生产者压缩(例如设置为 gzip),并且代理配置也设置为相同的编解码器,代理是否会重新压缩来自生产者的任何消息,或者识别其相同的编解码器并跳过和代理端重新-压缩?

I'm aware that the broker can be configured to inherit broker codec via the 'producer' setting.我知道可以将代理配置为通过“生产者”设置继承代理编解码器。 However, for our scenario we may have producers (out of our control) who may not set any compression, so we'd like to configure the broker to have default compression enabled, but for those producers that are in our control we'd prefer to use producer compression to save on network bandwidth but also the reduce load on the broker.但是,对于我们的场景,我们可能有生产者(不受我们控制)可能没有设置任何压缩,因此我们希望将代理配置为启用默认压缩,但对于那些在我们控制范围内的生产者,我们更喜欢使用生产者压缩来节省网络带宽,同时减少代理的负载。

Setting topic compression to producer is equivalent to setting it to the same value you use in your producers.将主题压缩设置为producer相当于将其设置为您在生产者中使用的相同值。 Thus to achieve what you need, you just need to set topic compression to the same algo you use in your producers.因此,要实现您的需求,您只需将主题压缩设置为您在生产者中使用的相同算法。 The external producers that use the same compression algorithm will work the same as your internal producers, and the rest will trigger a potential decompression/recompression.使用相同压缩算法的外部生产者将与您的内部生产者工作相同,其余的将触发潜在的解压/重新压缩。

This article sums it up nicely: https://newbedev.com/if-i-set-compression-type-at-topic-level-and-producer-level-which-takes-precedence这篇文章总结得很好: https : //newbedev.com/if-i-set-compression-type-at-topic-level-and-producer-level-which-takes-precedence

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM