fluent-plugin-kafka icon indicating copy to clipboard operation
fluent-plugin-kafka copied to clipboard

events distribution in kafka partitions

Open galactus009 opened this issue 5 years ago • 4 comments

Hello

We are having unequal events distribution of events in the partitions. our topic have 8 partitions we are noticing that one of the partition getting bulk of the events others paritions are getting very less. please advise.

Below is our fluentd-kafka-output config

<store>
	@type kafka_buffered
   	 brokers broker1:9092,broker2:9092,broker3:9092 
       default_topic MyTopic
       output_data_type msgpack
       output_include_tag true
       get_kafka_client_log false
       buffer_type file
       buffer_path /tmp/td-agent/buffer
       flush_interval 3s
       required_acks 1
       num_threads 8
</store>

galactus009 avatar Jun 13 '19 06:06 galactus009

Any guidance is appreciated

galactus009 avatar Jun 14 '19 05:06 galactus009

https://github.com/zendesk/ruby-kafka/blob/master/lib/kafka/partitioner.rb

Here is an implementation of partitioner. I'm not sure why rand returns wrong distribution. One approach is specify partition_key or partition_key_key to use value based distribution.

repeatedly avatar Jun 14 '19 05:06 repeatedly

It somehow parses message_key and partition_key as empty string which supposed to be nil Since message_key and partition_key are empty string then it doesnt go through rand(partition_count) condition.

im investigating and update or open a PR after I figure out why setting

default_partition_key "#{ENV['FLUENT_KAFKA_DEFAULT_PARTITION_KEY'] || nil}"
default_message_key "#{ENV['FLUENT_KAFKA_DEFAULT_MESSAGE_KEY'] || nil}"

parses default_partition_key and default_message_key as empty string.

hope it helps.

punneng avatar Jun 28 '19 15:06 punneng

This issue has been automatically marked as stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 30 days

github-actions[bot] avatar Jul 06 '21 10:07 github-actions[bot]