I have a spring boot application running on 3 containers. I need to design a service which read from the database every 5 minutes and then perform some calculation over the data.
I can write a function using @schedule annotation to run every 5 minutes. But how can I make sure that all containers are not processing on same data. Is there a way, I can distribute the load to all containers?
Support there are 1800 records in the database on which I need to perform calculation every 5 minutes. So each container can process 600 records every 5 minutes and at any point of time if one container go down then other two can manage the load.