Expand my Community achievements bar.

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

How to check if workflows fires in proper queue (AEM6)

Avatar

Level 2

Hi.

 

I have added new Apache Sling Queue (to Apache Sling Job Queue Configuration), with three topics (workflows). I have configured maximum parallel jobs to 1, and now I would like to check if this configuration works. I would like to assign small ammount of server resources for those workflows, because they run for about ~20 minutes and CQ slows down when workflows are fired, I set priority to min. Queue type is parallel (I'm thinking if changing type to ordered would be better ? I assume that workflows will be fired one by one, never two in the same time, but I expect the same result with queue type set to parallel and maximum parallel jobs set to 1).

So how can I check if workflows fire one by one ?

1 Accepted Solution

Avatar

Correct answer by
Level 6

Easiest way is to use the Logger and then log each job that is created and running. The queue monitor (in the JMX Console) would only show that there are jobs in the queue and how long they have been running.

Using parallel and 1 is not the same as ordered queue and single execution. The first one takes more resources and will aways start a thread pool. The second one only has one executor running at the same time. If you only want one job running at the time due to resource race conditions (like, more than one job may alter the same node at the same time), then I would go for ordered queue instead. That implementation seems to be more solid.

/Ove

View solution in original post

4 Replies

Avatar

Correct answer by
Level 6

Easiest way is to use the Logger and then log each job that is created and running. The queue monitor (in the JMX Console) would only show that there are jobs in the queue and how long they have been running.

Using parallel and 1 is not the same as ordered queue and single execution. The first one takes more resources and will aways start a thread pool. The second one only has one executor running at the same time. If you only want one job running at the time due to resource race conditions (like, more than one job may alter the same node at the same time), then I would go for ordered queue instead. That implementation seems to be more solid.

/Ove

Avatar

Level 2

Thank you for the answer.

I forgot to mention that when queue type is set to Parallel, I also set the thread pool to 5 (also tried with 1 and 2, but here wasn't any big differences between those configurations)

Avatar

Level 6

No, it should not be any difference at all. The only difference would be that you see 4 idle threads being created and never used. Having n threads in a pool and saying that you can't do any more than one job in parallel is the same as saying do it in an ordered queue, using one thread. You can set the thread pool to 100, it would still only use one.

I use a grocery store example to visualize this.

Imagine that you have a grocery store with 5 checkouts. Your task is to implement a cash register system. You can do it in a number of ways. One queue to all the checkout desk and when a desk gets free, take the next in the queue (Ordered Queue, Shared resources). Separate queues to each checkout, when a customer arrives at the checkout, it must take the next queue (Round robin). Separate queues to each checkout, when customer arrives at the checkout, it takes the queue that has the least amout of customers (Job flow controll). Separate queues to each checkout, when customer arrives at the checkout, it takes the queue that has the least amout of articles in the customers carts (Workload controll).

You can mess with all these if you design your system so that one and only one checkout can use the backend registry at the same time...

This is the way I use to visualize job queues.

Avatar

Employee

@Ove_Lindström @marekk26418255 

Is it possible to share a sample config data for Apache Sling Job Queue Configuration with three topics workflows.

 

I have similar requirement to override the config only for specific custom workflow modal.

 

Thanks