Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

AEM Cloud: is scheduler run on each instance?

Avatar

Level 9

I have found relatively little info about schedulers in AEM, but I understand you can schedule them like cron jobs, e.g. run every 5 mins.

 

With AEM cloud, Adobe take care of spinning up additional instances as required by load.  

In this case, will multiple copies of each scheduler be run?  Or does AEMN have some kind of master and slave schedule service, so each scheduler only runs once?

 

The same question applies to ehcache - does each publish instance get its own copy of the cache?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

By default the scheduler runs on all instances, and that's not different at all to any on-prem and AMS based environment. For clustered instances (like the authoring instances in AEM as a Cloud Service) you have the option to run it only on the master.

 

The documentation available at https://sling.apache.org/documentation/bundles/scheduler-service-commons-scheduler.html is quite good and explains also howto run a scheduled job only once per cluster.

View solution in original post

6 Replies

Avatar

Community Advisor

Hi @TB3dock,

 

Schedulers are event handling mechanism which can run on the instance as per the cron job provided. They would run on the instance if the code is present in them - even though adobe creates some extra instances [which would be a backup or replica of existing instances]

 

To know more on the annotations of different event handling mechanisms please check my blog here.

 

Hope this helps!

 

Thanks,

Kiran Vedantam

Avatar

Level 9
thanks for the reply. This doesnt answer the question unfortunately. If I have a scheduler in my myode, and I only deploy to a local author instance, I will only get one copy of the scheduler running. However, If I deploy my code to aem cloud production env, will mulitple copies of my scheduler run, or does it guarantee only a single copy be run? This is critical.

Avatar

Correct answer by
Employee Advisor

By default the scheduler runs on all instances, and that's not different at all to any on-prem and AMS based environment. For clustered instances (like the authoring instances in AEM as a Cloud Service) you have the option to run it only on the master.

 

The documentation available at https://sling.apache.org/documentation/bundles/scheduler-service-commons-scheduler.html is quite good and explains also howto run a scheduled job only once per cluster.

Avatar

Level 4

@Jörg_Hoh in your reply you state that this works for AEM authoring instances on AEMaaCS. However, does this work if we want to run a job on the AEM publish tier leader (ie. run on exactly one publisher regardless of AEM's auto-scaling)? It's a bit difficult to test this early to confirm as we'd need to release to staging (since AFAIK there's no way to simulate auto scaling on dev envs). Thank you!

Avatar

Employee Advisor

Hi,

 

currently it is not possible to run a job exactly once on the publish tier. In my opinion this hardly makes sense especially because you typically want to execute this operation when ALL publishs have received some content, and currently this is not possible to know on the publishs themselves.

 

 

Avatar

Level 1

Hi  Jörg_Hoh,

 

As we know in schedulers we can use the concept of Leader to make it run only on one author instance. But can this be handled for workflow launchers as well, so that it runs only on one instance?