如果 Kafka 生产者设置是在代理而不是生产者中定义的,它会被采用吗?

Will a Kafka producer setting take if it is defined in the broker, not producer?

我正在尝试设置 compression.type,目前正在我的代理配置中进行设置。如果我的producer里面没有定义属性,会不会生效?我没有在我的生产者部署中指定任何 compression.type 值甚至 属性。

这取决于你想压缩什么。您可以压缩发送的数据,也可以压缩存储在主题中的数据。因此,在代理端定义它以配置数据的保存方式或在生产者端定义它以配置数据的发送方式

经纪方:

Specify the final compression type for a given topic. This configuration accepts the standard compression codecs ('gzip', 'snappy', 'lz4', 'zstd')

参考confluent documentation

制作方:

The compression type for all data generated by the producer. The default is none (i.e. no compression). Valid values are none, gzip, snappy, lz4, or zstd.

参考confluent documentation

这两个属性有不同的用途,请参阅 Kafka reference doc

在生产者端定义时,compression.type 编解码器用于压缩每个批次以进行 传输,从而提高通道吞吐量。

在主题(代理)级别,compression.type 定义了用于在 Kafka 日志中存储 数据的编解码器,即最大限度地减少磁盘使用。特殊值 producer 允许 Kafka 保留生产者设置的原始编解码器。