[
https://issues.apache.org/jira/browse/SLING-5387?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15984469#comment-15984469
]
Stefan Egli commented on SLING-5387:
------------------------------------
Not sure if taking just the first two characters of the hash is distributing
the keys 'enough' - but given that is the case then I agree. Especially doing
the modulo number of instances in the cluster will do the trick as yes, all
instances see the same order of the InstanceDescription in the ClusterView.
What has to be taken into consideration is the fact that one might loose
'ownership' of such a singleton job if one of the 'higher ranking' instances
leaves the cluster. And that transition must be done precisely. Ie as soon as a
TOPOLOGY_CHANGING event is received the scheduled job execution should
pause/stop, and only resume once a new TOPOLOGY_CHANGED is received (at which
point the hashing/modulo thing must be reevaluated).
> Provide support for running singleton jobs on non leader cluster nodes also
> ---------------------------------------------------------------------------
>
> Key: SLING-5387
> URL: https://issues.apache.org/jira/browse/SLING-5387
> Project: Sling
> Issue Type: Improvement
> Components: Commons
> Reporter: Chetan Mehrotra
> Assignee: Carsten Ziegeler
> Fix For: Commons Scheduler 2.5.4
>
>
> With SLING-2979 support for running singleton jobs on specific instance was
> provided. In most cases we want to run a job as singleton and not want to
> "pin" it to specific nodes. For this {{scheduler.runOn}} needs to be set to
> {{SINGLE}}.
> However per [current
> implementation|https://github.com/apache/sling/blob/org.apache.sling.commons.scheduler-2.4.14/src/main/java/org/apache/sling/commons/scheduler/impl/QuartzJobExecutor.java#L64]
> {{SINGLE}} is treated as {{LEADER}}. This effectively causes *all singleton*
> jobs to get executed on leader only thus putting extra load.
> For better utilization of cluster resources it should be possible to
> distribute such singleton jobs on other cluster nodes and still ensure that
> singleton contract is honoured!
> We would like to make use of this feature to ensure Oak AsyncIndexTask to run
> on different cluster nodes (OAK-2749)
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)