Book Image

Apache Kafka Cookbook

By : Saurabh Minni
Book Image

Apache Kafka Cookbook

By: Saurabh Minni

Overview of this book

<p>This book will give you details about how to manage and administer your Apache Kafka Cluster.</p> <p>We will cover topics like how to configure your broker, producer, and consumer for maximum efficiency for your situation. Also, you will learn how to maintain and administer your cluster for fault tolerance. We will also explore tools provided with Apache Kafka to do regular maintenance operations. We shall also look at how to easily integrate Apache Kafka with big data tools like Hadoop, Apache Spark, Apache Storm, and Elasticsearch.</p>
Table of Contents (15 chapters)
Apache Kafka Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Configuring the thread and performance for producer


These are the settings you need to configure if you want to get the best performance out of your Kafka producer.

Getting ready

You can start by editing the producer.properties file in the config folder of your Kafka installation. This is another key value pair file which you can open to edit in your favorite text editor.

How to do it...

Proceed with the following steps to configure the thread and performance for producer:

  1. You can set the producer.type value:

    producer.type=sync
    
  2. Set the serializer.class value:

    serializer.class=kafka.serializer.DefaultEncoder
    
  3. Set the key.serializer.class value:

    key.serializer.class=kafka.serializer.DefaultEncoder
    
  4. Set the partitioner.class value:

    partitioner.class=kafka.producer.DefaultPartitioner
    
  5. Set the compression.codec value:

    compression.codec=none
    
  6. Set the compressed.topics value:

    compressed.topics=mytesttopicl
    
  7. Set the message.send.max.retries value:

    message.send.max.retries=3
    
  8. Set the retry.backoff.ms value...