Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change kafka producer client config (backport #2030) #2062

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions protocol/indexer/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ type IndexerFlags struct {

// List of default values
const (
DefaultMaxRetries = 3
DefaultMaxRetries = 20
)

// List of CLI flags
const (
FlagKafkaConnStr = "indexer-kafka-conn-str"
FlagKafkaConnStr = "indexer-kafka-conn-str"
// max retry should be set so that max retry * retry backoff > Zookeeper session.timeout + some buffer
FlagKafkaMaxRetry = "indexer-kafka-max-retry"
FlagSendOffchainData = "indexer-send-offchain-data"
MsgSenderInstanceForTest = "msgsender-instance-for-test"
Expand Down
3 changes: 3 additions & 0 deletions protocol/indexer/msgsender/msgsender_kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ func NewIndexerMessageSenderKafka(
config.Producer.Return.Errors = true
config.Producer.Return.Successes = true
config.Producer.Retry.Max = indexerFlags.MaxRetries
// max retry should be set so that max retry * retry backoff > Zookeeper session.timeout + some buffer
config.Producer.Retry.Backoff = 1000 * time.Millisecond
config.Producer.MaxMessageBytes = 4194304 // 4MB
config.Producer.RequiredAcks = sarama.WaitForAll
// Use the JVM compatible parititoner to match `kafkajs` which is used in the indexer services.
config.Producer.Partitioner = kafkautil.NewJVMCompatiblePartitioner
producer, err := sarama.NewAsyncProducer(indexerFlags.KafkaAddrs, config)
Expand Down
Loading