How to run one job per cluster?


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

This widget could not be displayed.

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.

This widget could not be displayed.

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) "". 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
Community showcase
Posted yesterday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

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...

155 views 2 4
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