We have an image processing pipeline on GKE which is feed from a GCP Topic which in turn is feed by bucket notifications i..e
image upload > bucket > notification > topic < pods consume files off topic.
This scales nicely but occasioanlly pods die or get scalled down and with them the data from the topic that they consumed. Is there a container design pattern to make sure that the file gets processed even if the pod dies unexpectantly?
(Sorting out what was missed is kind of a nightmare when your dealing with millions of image files).
Yeah, i just had a good long think about it and came up with a 2 queue solution with, what I'm going to call, the Accountant pod/container (as the idea is based on double entry book keeping):
I call it the: Double-Entry/Accountant Design Pattern :)
I think this can be applied to most data processing queue systems.
The only flaw I see in it is if the accountant dies (but it should be a lightweight job to check input vs output). I guess then you can have N queues with N-1 accountants depending on how certain you want to be (but coordinating more than 1 accountant might be tricky)