Last year we've deployed confluence for our customer and recently it turned out that some (custom - self devloped in our plugin) our jobs are executed per node. We want to make it execute once per cluster.
Ah, a classical problem of distributed processing ....
You can either:
a) synchronize via DB (which is a shared resource anyway). For instance you create a running flag table and you run queries like:
update flagtable set f_running = 1 where f_running = 0;
Logic: if update count is 1, you can enter into processing. Finally, you must set the flag on zero, so "update flagtable set f_running = 0" will be necessary.
However, if current processing node fails completely, the flag will be set forever on 1, so the remaining nodes will be unable to progress. Manual or timeout recovery should be available.
Advantage: it's simple, most people understand it, you don't need to worry to much if it fails, it is usually acceptable to reset those counters after some time or manually.
b) Create a ring between the nodes of your cluster. Pass a token (message) from node to node; when the node receives the token, it can run.
Fun to implement, various algorithms exist. Disadvantage: Cost is high.
c) Use libraries that have already these implemented (check if quartz has it - I do not use quartz, so I'm not familiar with it, it's kinda "jobs for everyone" with a yellow page on top - link here).
d) Use libraries that creates shared memory over your nodes to shield you from low details. I do not know what's the status of JavaSpaces, it was intended to be for java what Linda/Glenda was for C.
Edit: let's not forget:
e) Create asymmetric installs. For instance, you set up a node with a configuration (JNDI string) "do.my.processing". In case of failure, you need to manually change that flag on some other node. Not very funny / smart.
Hi my Community friends! For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs