Hey guys I have question about Flink backpressure....
# troubleshooting
m
Hey guys I have question about Flink backpressure. I have the following structure
Copy code
DataStream<Result> a = processA(...)
DataStream<Result> b = processB(...) 
sinkToDB(a.union(b))
one of the processors inside
processA
is busy at 100%, and I see it makes the process at
processB
to have backpressure 100%, although it happens before the union and they have no relation before. Does it make sense? Possibly to keep the watermarks aligned the union maybe causing
b
to wait for
a
?
r
I'm surprised by that behaviour too. Did you enable watermark alignment for your sources? https://nightlies.apache.org/flink/flink-docs-release-1.18/docs/dev/datastream/event-time/generating_watermarks/#watermark-alignment
What sometimes helps to debug backpressure is to disable operator chaining, then you'll see which operator is contributing to backpressure.
Also, in the UI, you can drill down into the "per subtask" view to see if a subtask is busy or backpressured
I would be curious to learn what the sink is doing. I would hope your sink is 99% of the time idle -- but what you are describing makes me think the source is 50+% busy, causing backpressure on both upstream (a and b) operators
m
Hey, I did not enable watermark alignment but thought maybe there is underlying automatic mechanism. The sink is JDBC sink into postgres, can it be a bottleneck even if it displayed with "busy 0%"?
r
I don't think so
you need to observe it over a longer period of time, but it should me marked as "busy 100%" if the database is not able to keep up with the incoming data rate
m
Thanks, I posted the question also in SO, got a suggestion to use unaligned checkpoints. will try that
@rmetzger Hey, I tried the unaligned checkpointing and it didn't make noticeable difference. On the other hand, I cancelled the union and just did sink twice and it solved it, A and B now act independently and
A
is able to quickly catch up to current time in the watmerark while
B
is busy for much longer time. Don't know why the union caused this problem though
Copy code
DataStream<Result> a = processA(...)
DataStream<Result> b = processB(...) 
sinkToDB(a)
sinkToDB(b)
r
I'm happy to hear that you've resolved the issue. I'm still trying to find an explanation for this behavior