We are facing a checkpoint timeout in our applicat...
# troubleshooting
j
We are facing a checkpoint timeout in our application. We have events that take more than 10 minutes to process, causing the issue(Since the default checkpoint timeout is 10 minutes). Here is an overview of what we are doing. We have a job in which there are members and offers. Whenever an offer is created we need to evaluate this offer against all the members in the system. Currently, the members are kept in the Flink state and offer details are coming as an event from Kafka. It takes too much time to validate an offer against all the members and store it in the DB which causes the issue. Details of the job are added in the image attached. Any help would be extremely appreciated.
s
Could you please try to look for more error (other than timedout exception) Or is that the only error you see in the pipeline?
j
That is the only error in the pipeline. As per my analysis, due to backpressure checkpoint cannot be completed within 10 minutes which causes the issue. I have tried enabling unaligned checkpoints but that also didn't help. I am not sure whether I have designed this job correctly.
s
You may need to access what configurations suits your processing engine the best which purely depends on the data being flown through You can try considering tweaking few(if not all) of the below properties which should definitely get your problem in better state(if not solves entirely)
Copy code
checkpoints.millis.timeout=m (should finish in m millis ; increase a bit)
checkpoints.min.pause=x (runs every x minutes ; increase a bit)
checkpoint.min.interval=

#below 2 property should be handled carefully 
default.parallelism= inc or dec depending on the behaviour
taskmanager.numberOfTaskSlots: try increasing this 

taskmanager.memory.process.size: in my case increase 20% worked
taskmanager.memory.managed.fraction: in my case, it was toooo low ie 0.05; so set it to 0.6
taskmanager.memory.jvm-overhead.min: can start with 2gb may be
taskmanager.memory.jvm-overhead.fraction: 0.1
taskmanager.memory.jvm-overhead.max: can start with 3 or 4gb may be
Please keep a track of different versions/combinations of property(values) set and their behaviour which will help in setting them in futher/higher iterations Idea is, basically trial and run, with learning/improvising from past runs Initial few runs you may feel clueless, but as you keep running multiple times, you will get some idea about what value could solve this situation . Do let me know whenever things works Good luck.
j
I haven’t increased the checkpoint timeout yet because when the number of members increases again there will be chance for timeout. Instead of updating the configuration, is there a better way to implement this job. One approach that I tried was to split this job into two. In the first job combine the offer and member into a tuple and send it to Kafka. Then the second job will be responsible for doing the actual processing and updating the DB. In this approach again the first job is getting timed out.
s
when i faced this issue i dint have 2 source data streams but changing configs solved the issue However currently I too have similar job flow, where in 1 stream comes from KafkaSource and second is JdbcSource (straightaway query from db) and then connect 2 streams then process and write to KafkaSink so with same configs things are running fine
Also use broadcast only if it is really needed
if the setup and deploy is easier/quicker, try without broadcasting
j
For an offer event I need to process for all the members in the state(now 50k members are there while I am testing, which will increase to 50 million in production) which is why I have broadcast the offer event. Is there a way to do it without broadcasting?
s
I feel u can try doing this using .connect() with CoProcessFunction , where you handle what should be your state, how to handle new keys, updating them in state etc
something like:
Copy code
memberStream.connect(offerStream)
.keyBy()
.process()
I am not sure if this is the optimal approach though but definitely a solution worth trying i feel any thoughts?
j
Will the offer get processed for all the members if I am not using broadcast()? Currently, I am doing like this
Copy code
memberStream.connect(offerStream.broadcast())
s
In my case we can skipped broadcast for 2 reasons: • none of the streams were small in size • the one which smaller among 2, is not so frequently updating(ie JdbcSource) but your use case is not same. so youre right, you may need to go with broadcast
j
Yes