How to utilize full efficiency of Java EE timers on clustered environment
posted 3 years ago
I have an application which contains timers which will select 100 records from mysql table and process it and update those rows. The application is deployed on 2 nodes of clustered environment. The problem is both the
timers picks up the same 100 rows.
I want to utilize the efficiency of timers since both are running on different nodes. The 1st timer should picks up the first 100 records and the 2nd node timer should picks up next 100 records and so on. So that now same records are processed in different nodes.
I tried using pessimistic lock in the query in application but , i guess it will have some performance hit since the table contains millions of records.
Is there any better design to handle this problem or we can only use locks to do this.