Hello guys, I am writing a kafka consumer flink jo...
# random
t
Hello guys, I am writing a kafka consumer flink job, our flink and kafka clusters are in different geo location and thats why network lag is slowing down our throughput, I am exploring the idea of concurrent kafka poll per partition per task manager a with different offset range to increase the throughput. I am planning to write custom RichParallelSourceFunction for kafks source and use multithreading in run(). I'd appreciate some suggestions or recommendations.
j
What kind of Kafka config changes have you tried? If your network hops are expensive, I'd try raising
fetch.min.bytes
,
fetch.max.bytes
,
max.poll.records
to start. It's also worth raising parallelism if there are enough Kafka Partitions for it.
t
I had tried increasing all three of them but somehow still not able to keep up with high volume and parallelism is same as number of topic partitions
the final resort would be to increase kafka partitions but that would affect other consumer jobs as well which are performing already. I know spark allows concurrent microbatches with different offset ranges but I was wondering If something similar is possible with Flink
j
Are you seeing back pressure?
t
I am not seeing much of back pressure on flink side, but kafka lag stays high because we are not able to poll data quick enough
j
Did you also try raising
max.partition.fetch.bytes
? Usually Kafka does really well pushing up your batch size when you run behind.
And Flink does a good job pushing the records downstream, as long as there's no backpressure
t
yes, I tried increasing that too but still not much of difference
I can play around with this config little more
but somehow not able to consume fast enough
j
I'd raise those max partition fetch bytes values both up absurdly high. If you're doing 1 consumer per partition, they should be the same. If you know how large your records are, calculate approximately how much memory you should need for 1 second of traffic, and set it to that.