Suhashini Lokesh
Suhashini Lokesh

Reputation: 1

Cron job scheduled in spring app to distribute data with all instances

I have a design question Cron job scheduled in spring app using @scheduled, I have 4 instances and I want the job to run in all the instances by distributing data. Say I need to process 1000 data, each instance should process 250 data. Any idea how this can be achieved. Instances are using kubernetes pod

Tried locking the data row level but this might not be a good approach

Upvotes: 0

Views: 154

Answers (1)

Kaj Hejer
Kaj Hejer

Reputation: 1040

We had just the same issue and solved it by the solution described in https://vladmihalcea.com/database-job-queue-skip-locked/.

Upvotes: 0

Related Questions