title: Kafka set compression type at producer vs topic
body: <p>What's the difference between the following ways of enabling compression in kafka:</p>
  
  <p>Approach 1: Create a topic using the command:</p>
  
  <pre><code>bin/kafka-topics.sh --create --zookeeper localhost:2181 --config compression.type=gzip --topic test
  </code></pre>
  
  <p>Approach 2: Set the property compression.type = gzip in Kafka Producer Client API.</p>
  
  <p>I get better compression and higher throughput when using Approach 1.</p>
  
  <p>If I use Approach 1, does it mean that the compression occurs at the broker end while in Approach 2, the messages are compressed at Producer end and then sent to broker?</p>