Sling jobs random distribution in mongo cluster of 2 author instances in AEM 6.5 | Community
Skip to main content
Uppari_Ramesh
Level 5
March 6, 2025
Solved

Sling jobs random distribution in mongo cluster of 2 author instances in AEM 6.5

  • March 6, 2025
  • 2 replies
  • 572 views

We have mongo cluster of 2 author instances and the sling jobs distribution is random.

 

Adobe says, in author cluster by default sling jobs will be distributed to all nodes in the cluster. But in our case sling jobs are randomly distributing i.e. sometimes jobA is getting distributed two author instances and sometimes same jobA with different payload map is executing in only author1 instance but not in author2. Any suggestions for this random behaviour?

 

Thanks,

Ramesh.

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Uppari_Ramesh

Hi @arunpatidar @giuseppebaglio ,

 

I have debugged the issue further and found that the jobs were distributing to other instance because of load. A job with same topic was running on author1 hence job2 was distributed to author2.

To know or if someone is looking for execution of jobs in same instance where they are created then they can create a job queue for the topic and enable queue.preferRunOnCreationInstance=B"true" then it will ensure job running in same instance instead of load distributing.

2 replies

arunpatidar
Community Advisor
Community Advisor
March 6, 2025

Hi @uppari_ramesh 

Not sure if this can help or not.

 

The client sending an event has to mark an event to be distributed in a cluster by setting the event.distribute in the event properties

 

https://sling.apache.org/documentation/bundles/apache-sling-eventing-and-job-handling.html#event-distribution-across-application-nodes-cluster-1 

Arun Patidar
giuseppebaglio
Level 10
March 7, 2025

Consider also the following steps:

  • verify node capabilities and ensure both nodes are capable of processing the job topics.
  • check job consumer registrations and confirm that both nodes have the necessary jobconsumer services registered for the job topics.
  • you can use the sling topology and job handling mechanisms to monitor how jobs are being distributed across nodes.
  • if jobs with different payloads are being executed on different nodes, it might be due to how the payload is constructed or how the job is initiated.

 

 
Uppari_Ramesh
Uppari_RameshAuthorAccepted solution
Level 5
March 13, 2025

Hi @arunpatidar @giuseppebaglio ,

 

I have debugged the issue further and found that the jobs were distributing to other instance because of load. A job with same topic was running on author1 hence job2 was distributed to author2.

To know or if someone is looking for execution of jobs in same instance where they are created then they can create a job queue for the topic and enable queue.preferRunOnCreationInstance=B"true" then it will ensure job running in same instance instead of load distributing.