How to run one job per cluster?

Hi,

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.

Any ideas?

2 answers

1 accepted

It looks like I have to answer my own Q. In atlassian plugin you have to add parameter (in job line) perClusterJob=true.

Thats all. Heres the magic wand.

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.

I wish I had a magic wand .... it is a custom, self-developed plugin, right? Then, you need toprogram it correctly. Check if the quartz embedded into the product helps you (If I remember well, there's already there a quartz).

Well, I am aware that I can implement all this by myself. However I wonder if there is any out-of-box solution in confluence for this...

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,916 views 27 12
Join discussion

Atlassian User Groups

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!

Find my local user group

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

Groups near you