Prioritized async executor

Hi Flowable community,

We like your product very much and we appreciate all the good work you’re doing. We are considering to use Flowable as a central part for reimplementation of one of our products. There are still some questions that we would like to be cleared before we dive into the actual implementation. These are some important facts for our use case:

  1. there would be a large number of processes (hundreds of thousands) started, but eventually waiting to proceed, using timers
  2. sometimes the wait times would be changed through configuration update, which would require signalling and updating thousands of timers
  3. when timers expire, thousands of processes would have to be executed simultaneously, some of them more important than others

Our question here is: is it possible for async executor to run prioritized jobs? What are the best practices when handling such large numbers of jobs?

One possible solution that we thought of was using prioritized message queues. Later we discovered “Message Queue based Async Executor” part in the documentation, which could be extended with something like JMS priorities for example. Is this something you would recommend?

Regards,
Marko

Thanks :slight_smile:

That’s indeed a good reasoning. Now mind you, the default (thread-based) async executor is performant and should be able to handle a serious load. However, prioritisation means that the queries would need be changed. We’ve seen in the past that in large database tables, that this leads to unwanted table scans.

The message queue executor would indeed be a solution here, however it doesn’t have the concept of sending something to a different queue implemented (yet). It would mean for example that this class flowable-engine/MessageBasedJobManager.java at main · flowable/flowable-engine · GitHub needs more logic to handle this.

Hi Joram,

So our own version of MessageBasedJobManager would be the solution? Using different queues is one option, but there is also a concept of different JMS priorities for the same queue. Spring’s JmsTemplate already has setPriority(int priority) method which works with the broker we are using (AMQ). There isn’t an easy way to specify and “propagate” priority per task, though. But I guess we could at least use different priorities for timers and regular async tasks using JobInfo/Job instance, maybe even having different priorities per process definition as it provides process definition ID.

Is there anything else we should be focusing on, in a scenario which includes a large number of timer tasks? Tweaking some properties, e.g. asyncExecutorMaxTimerJobsPerAcquisition?

Regards,
Marko