cancel
Showing results for 
Search instead for 
Did you mean: 

AsyncExecutor job acquirement order

mamuf
Champ in-the-making
Champ in-the-making
Hi,

I would like to be able to set preferred ordering of Activiti Jobs acquired for execution. Our team is implementing Activiti engine for performance processing of data transfers. For each transfer a new Activiti process instance is created which performs some pre- and post- tasks along the transfer itself. Almost every task in that process is a Java-based service task and almost all of them are executed with async=true, so the Job executor is quite crucial in our setup.

Transfers (= processes) are generated through the whole day in batches. There are tens of thousands of transfers through the day, but there are peak hours during which thousands of transfers need to be processed.

The problem is, when more than a few hundred Activiti processes are started in a short time (minutes), the way the Jobs are selected from DB leads to newer Jobs to jump the "queue", ie. older processes take more time than the new ones because their async Jobs have to wait for newer Jobs to execute.

Now, I have found that the class AcquireAsyncJobsDueCmd executes the "selectAsyncJobsDueToExecute" statement for Job entity, but there is no ORDER BY, so the ordering is solely on the DB itself.

Is it be possible to force the AsyncExecutor to select oldest Jobs first — ie. FIFO? Thanks.
1 REPLY 1

trademak
Star Contributor
Star Contributor
When you are using the new AsyncExecutor all jobs are executed FIFO by default. But when the ThreadPool can't handle the load anymore the jobs will be queried from the database (without the ORDER BY). Did you try to change the ThreadPool settings, to be able to deal with the load you have?

Best regards,