Search code examples
apache-kafkaapache-kafka-streamsconfluent-platformksqldb

ksqlDB - How to set batch.size and linger.ms for producers to optimise compression


When configuring ksqlDB I can set the option ksql.streams.producer.compression.type which enables compression for ksqlDB's internal producers. Thus when I create a ksqlDB stream, it's output topic will be compressed with the selected compression type.

However, as far as I have understood the compression performance is heavily impacted by how much batching the producer does. Therefore, I wish to be able to configure the batch.size and linger.ms parameters for ksqlDB's producers. Does anyone know if and how these parameters can be set for ksqlDB?


Solution

  • Thanks to Matthias J Sax for answering my question on the Confluent Community Slack channel: https://app.slack.com/client/T47H7EWH0/threads?cdn_fallback=1

    There is an info-box in the documentation. That explains it pretty well:

    KSQL documentation info box

    The underlying producer and consumer clients in ksqlDB's server can be modified with any valid properties. Simply use the form ksql.streams.producer.xxx, ksql.streams.consumer.xxx to pass the property through. For example, ksql.streams.producer.compression.type sets the compression type on the producer.

    Source: https://docs.ksqldb.io/en/latest/reference/server-configuration/