<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Any tips on how to optimize Kafka broker performance? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Any-tips-on-how-to-optimize-Kafka-broker-performance/m-p/169478#M49945</link>
    <description>&lt;P&gt;I was wondering if you can share some of your experience with the following server.properties parameters:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;PRE&gt;message.max.bytes
num.network.threads
num.io.threads
background.threads
queued.max.requests
socket.send.buffer.bytes
socket.receive.buffer.bytes
socket.request.max.bytes
num.partitions&lt;/PRE&gt;
&lt;/LI&gt;&lt;/OL&gt;</description>
    <pubDate>Fri, 23 Dec 2016 10:38:43 GMT</pubDate>
    <dc:creator>demerovb</dc:creator>
    <dc:date>2016-12-23T10:38:43Z</dc:date>
    <item>
      <title>Any tips on how to optimize Kafka broker performance?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Any-tips-on-how-to-optimize-Kafka-broker-performance/m-p/169478#M49945</link>
      <description>&lt;P&gt;I was wondering if you can share some of your experience with the following server.properties parameters:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;PRE&gt;message.max.bytes
num.network.threads
num.io.threads
background.threads
queued.max.requests
socket.send.buffer.bytes
socket.receive.buffer.bytes
socket.request.max.bytes
num.partitions&lt;/PRE&gt;
&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Fri, 23 Dec 2016 10:38:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Any-tips-on-how-to-optimize-Kafka-broker-performance/m-p/169478#M49945</guid>
      <dc:creator>demerovb</dc:creator>
      <dc:date>2016-12-23T10:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Any tips on how to optimize Kafka broker performance?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Any-tips-on-how-to-optimize-Kafka-broker-performance/m-p/169479#M49946</link>
      <description>&lt;P&gt;@&lt;A href="https://community.hortonworks.com/users/14469/demerovb.html"&gt;Boris Demerov&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/14469/demerovb.html"&gt;&lt;/A&gt;Usually, you don't need to modify these settings, however, if you want to extract every last bit of performance from your machines, then changing some of them can help. You may have to tweak some of the values, but these worked 80% of the cases for me:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;message.max.bytes=1000000&lt;/LI&gt;&lt;LI&gt;num.network.threads=3&lt;/LI&gt;&lt;LI&gt;num.io.threads=8&lt;/LI&gt;&lt;LI&gt;background.threads=10&lt;/LI&gt;&lt;LI&gt;queued.max.requests=500&lt;/LI&gt;&lt;LI&gt;socket.send.buffer.bytes=102400&lt;/LI&gt;&lt;LI&gt;socket.receive.buffer.bytes=102400&lt;/LI&gt;&lt;LI&gt;socket.request.max.bytes=104857600&lt;/LI&gt;&lt;LI&gt;num.partitions=1&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Quick explanations of the numbers:&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;&lt;CODE&gt;message.max.bytes&lt;/CODE&gt;: This sets the maximum size of the message that the server can receive. This should be set to prevent any producer from inadvertently sending extra large messages and swamping the consumers. The default size is &lt;CODE&gt;1000000&lt;/CODE&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;CODE&gt;num.network.threads&lt;/CODE&gt;: This sets the number of threads running to handle the network's request. If you are going to have too many requests coming in, then you need to change this value. Else, you are good to go. Its default value is &lt;CODE&gt;3&lt;/CODE&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;CODE&gt;num.io.threads&lt;/CODE&gt;: This sets the number of threads spawned for IO operations. This is should be set to the number of disks present at the least. Its default value is &lt;CODE&gt;8&lt;/CODE&gt;.&lt;/LI&gt;&lt;LI&gt;&lt;CODE&gt;background.threads&lt;/CODE&gt;: This sets the number of threads that will be running and doing various background jobs. These include deleting old log files. Its default value is &lt;CODE&gt;10&lt;/CODE&gt; and you might not need to change it.&lt;/LI&gt;&lt;LI&gt;&lt;CODE&gt;queued.max.requests&lt;/CODE&gt;: This sets the queue size that holds the pending messages while others are being processed by the IO threads. If the queue is full, the network threads will stop accepting any more messages. If you have erratic loads in your application, you need to set &lt;CODE&gt;queued.max.requests&lt;/CODE&gt; to a value at which it will not throttle.&lt;/LI&gt;&lt;LI&gt;&lt;CODE&gt;socket.send.buffer.bytes&lt;/CODE&gt;: This sets the &lt;CODE&gt;SO_SNDBUFF&lt;/CODE&gt; buffer size, which is used for socket connections.&lt;/LI&gt;&lt;LI&gt;&lt;CODE&gt;socket.receive.buffer.bytes&lt;/CODE&gt;: This sets the &lt;CODE&gt;SO_RCVBUFF&lt;/CODE&gt; buffer size, which is used for socket connections.&lt;/LI&gt;&lt;LI&gt;&lt;CODE&gt;socket.request.max.bytes&lt;/CODE&gt;: This sets the maximum size of the request that the server can receive. This should be smaller than the Java heap size you have set.&lt;/LI&gt;&lt;LI&gt;&lt;CODE&gt;num.partitions&lt;/CODE&gt;: This sets the number of default partitions of a topic you create without explicitly giving any partition size.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Number of partitions may have to be higher than 1 for reliability, but for performance (even not realistic :)), 1 is better.&lt;/P&gt;&lt;P&gt;These are no silver bullet :), however, you could test these changes with a test topic and 1,000/10,000/100,000 messages per second to see the difference between default values and adjusted values. Vary some of them to see the difference. &lt;/P&gt;&lt;P&gt;You may need to configure your Java installation for maximum performance. This includes the settings for heap, socket size, and so on.&lt;/P&gt;&lt;P&gt;***&lt;/P&gt;&lt;P&gt;Hope it helps. Pls vote/accept best answer&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 10:54:00 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Any-tips-on-how-to-optimize-Kafka-broker-performance/m-p/169479#M49946</guid>
      <dc:creator>cstanca</dc:creator>
      <dc:date>2016-12-23T10:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Any tips on how to optimize Kafka broker performance?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Any-tips-on-how-to-optimize-Kafka-broker-performance/m-p/169480#M49947</link>
      <description>&lt;P&gt;Hi &lt;A rel="user" href="https://community.cloudera.com/users/14469/demerovb.html" nodeid="14469"&gt;@Boris Demerov&lt;/A&gt;, please also see &lt;A rel="user" href="https://community.cloudera.com/users/170/wfloyd.html" nodeid="170"&gt;@Wes Floyd&lt;/A&gt;'s Storm &amp;amp; Kafka guide &lt;A href="https://community.hortonworks.com/articles/550/unofficial-storm-and-kafka-best-practices-guide.html"&gt;here&lt;/A&gt;. There's some overlap between it and &lt;A rel="user" href="https://community.cloudera.com/users/3486/cstanca.html" nodeid="3486"&gt;@Constantin Stanca&lt;/A&gt;'s recommendations, but you may find it useful anyway.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 15:01:59 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Any-tips-on-how-to-optimize-Kafka-broker-performance/m-p/169480#M49947</guid>
      <dc:creator>rgelhausen</dc:creator>
      <dc:date>2016-12-23T15:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Any tips on how to optimize Kafka broker performance?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Any-tips-on-how-to-optimize-Kafka-broker-performance/m-p/169481#M49948</link>
      <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/14469/demerovb.html"&gt;@Boris
Demerov&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Yes. Reference
provided by @&lt;A href="https://community.hortonworks.com/users/157/rgelhausen.html"&gt;Randy Gelhausen&lt;/A&gt; is
awesome, one of the best articles in HCC. It covers Kafka tuning practices
beyond the scope of your question, but it is a must read article. &lt;/P&gt;&lt;P&gt;I'd like to point out a few good rules of thumb related to your
question, which Wes in his article covered too (I extracted and commented a few):&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Set num.io.threads to at
least no. of disks you are going to use by default its 8. It be can higher than
the number of disks. &lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;A common broker server
has 8 disks. That is my current experience, however, this number can be
increased.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Set num.network.threads
higher based on number of concurrent producers, consumers, and replication
factor. &lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;The default value of 3
has been set based on field experience, however, you can take an iterative
approach and test different values until you find what is optimal for your
case.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Ideally you want to
assign the default number of partitions (num.partitions) to at least n-1
servers. This can break up the write workload and it allows for greater
parallelism on the consumer side. Remember that Kafka does total ordering
within a partition, not over multiple partitions, so make sure you partition
intelligently on the producer side to parcel up units of work that might span
multiple messages/events. &lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;Consumers
benefit from this approach, on producers – careful design is recommended. You
need to balance the benefits between producer and consumers based on your
business needs.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Kafka is designed for
small messages. I recommend you to avoid using kafka for larger messages. If
that’s not avoidable there are several ways to go about sending larger messages
like 1MB. Use compression if the original message is json, xml or text using
compression is the best option to reduce the size. Large messages will affect
your performance and throughput. Check your topic partitions and
replica.fetch.size to make sure it doesn’t go over your physical ram. Another
approach is to break the message into smaller chunks and use the same message
key to send it same partition. This way you are sending small messages and these
can be re-assembled at the consumer side.&lt;/EM&gt;&lt;/P&gt;&lt;P style="margin-left: 20px;"&gt;This complicates your
Producer and Consumer code in case of very large messages. Design carefully how
Producers and Consumers deal with large size messages. There are many ways to
implement compression or chunking, as well decompression and assembly. Choose
after testing your approach. For example, a high compression ratio is most of
the time an advantage but it comes with a price paid for
compression/decompression time. It is sometimes more efficient to have a lesser
compression as long as you can reduce the size of the message under 1MB, but
faster compression/decompression. It all comes-down to your SLAs whether they
are ms or seconds.&lt;/P&gt;&lt;P&gt;I am sure I did not cover
the domain completely, but hopefully this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 23:38:58 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Any-tips-on-how-to-optimize-Kafka-broker-performance/m-p/169481#M49948</guid>
      <dc:creator>cstanca</dc:creator>
      <dc:date>2016-12-23T23:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: Any tips on how to optimize Kafka broker performance?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Any-tips-on-how-to-optimize-Kafka-broker-performance/m-p/169482#M49949</link>
      <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/157/rgelhausen.html"&gt;@Randy Gelhausen&lt;/A&gt;, thank you for the link. I added that to my favorites!:)&lt;/P&gt;&lt;P&gt;@&lt;A href="https://community.hortonworks.com/users/3486/cstanca.html"&gt;Constantin Stanca&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thank you so much for your updated response. It provided valuable reasoning and advice and helped me to read easier Wes' article.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2016 23:51:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Any-tips-on-how-to-optimize-Kafka-broker-performance/m-p/169482#M49949</guid>
      <dc:creator>demerovb</dc:creator>
      <dc:date>2016-12-23T23:51:15Z</dc:date>
    </item>
  </channel>
</rss>

