You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kgo.FetchMaxWait is a config option supported by franz-go. It makes it
possible to use kgo.FetchMinBytes, but have a rather low max wait time
to fill the batch. This makes it possible to force the broker to send
big batches if possible, but still wait only for a short time if there's
not enough data.
This is especially important with the redpanda input, as it's using
ordered franz-go. It will only send batches, if the previous batch with
the partition has been consumed. If the broker keeps sending very small
batches, e.g. size 1, it's likely to stall batched outputs. I could
reproduce locally by using a producer that sends lots of batches of size
1.
Using kgo.FetchMinBytes in combination with kgo.FetchMaxWait can solve this
problem.
But in any case, it is a useful tuning knob offered by franz-go, but
also the standard Java client.
// FranzConsumerFields returns a slice of fields specifically for customising
@@ -87,6 +89,10 @@ Finally, it's also possible to specify an explicit offset to consume from by add
87
89
Description("Sets the maximum amount of bytes a broker will try to send during a fetch. Note that brokers may not obey this limit if it has records larger than this limit. This is the equivalent to the Java fetch.max.bytes setting.").
88
90
Advanced().
89
91
Default("50MiB"),
92
+
service.NewDurationField(kfrFieldFetchMaxWait).
93
+
Description("Sets the maximum amount of time a broker will wait for a fetch response to hit the minimum number of required bytes. This is the equivalent to the Java fetch.max.wait.ms setting.").
94
+
Advanced().
95
+
Default("5s"),
90
96
service.NewStringField(kfrFieldFetchMinBytes).
91
97
Description("Sets the minimum amount of bytes a broker will try to send during a fetch. This is the equivalent to the Java fetch.min.bytes setting.").
92
98
Advanced().
@@ -109,6 +115,7 @@ type FranzConsumerDetails struct {
109
115
FetchMinBytesint32
110
116
FetchMaxBytesint32
111
117
FetchMaxPartitionBytesint32
118
+
FetchMaxWait time.Duration
112
119
}
113
120
114
121
// FranzConsumerDetailsFromConfig returns a summary of kafka consumer
0 commit comments