producer到broker的消息发送流程

  Kafka的Producer发送消息采用的是异步发送的方式。在消息发送的过程中,涉及到了两个线程——main线程和Sender线程,以及一个线程共享变量——RecordAccumulator。main线程将消息发送给RecordAccumulator,Sender线程不断从RecordAccumulator中拉取消息发送到Kafka broker。

浅谈大数据里的Kafka (8)Producer消息发送流程

相关参数(使用Kafka API时经常需要定义,ProducerRecord对象无partitions和key值的传入情况下参数大小会影响分区结果):

batch.size:只有数据积累到batch.size之后,sender才会发送数据。

linger.ms:如果数据迟迟未达到batch.size,sender等待linger.time之后就会发送数据。

相关文章:

  • 2021-12-20
  • 2019-08-02
  • 2022-12-23
  • 2021-05-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-05
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2021-11-15
  • 2021-07-21
  • 2021-05-16
相关资源
相似解决方案