cancel
Showing results for 
Search instead for 
Did you mean: 

Load balancing jobs

kiyer
Champ in-the-making
Champ in-the-making
Hi,
I am relative newbie to Activiti and have enjoyed exploring it so far. Apologize if this question has been asked before, but here goes. My company has tasked me with investigating integration with Activiti Workflow to replace our hand rolled business logic in code.
I am modeling the subscription based services using Activiti workflow. Essentially it boils down to renew a subscription perpetually (annually) OR do an upgrade if the customer requests it. This is modeled as a parallel fork. See image here:

[img]https://docs.google.com/drawings/d/1VRRr8-i0DwmJ1-U6PXsyYQjd9mjGscII1Zx6XlhhVUI/pub?w=960&h=720[/img]

The idea is to have one such process instance per customer. The renewal sub-process would be fairly heavy duty and frequent (imagine daily , monthly , annual renewals). So the idea is to load balance it by executing all such jobs in dedicated machines. User tasks and other processes will be normally handled by user facing tomcat servers. This will enable the tomcats to be more responsive to handling immediate user facing tasks.

Question is: How can we split out arbitrary jobs (such as the renewal subprocess) and make it run on the specific machines?

Please note that I am aware of the following setting:

<property name="jobExecutorActivate" value="true" />
But the requirement is finer grained. Execute specific tasks on specific hardware.
Any guidance / tips appreciated.

Thanks for the great work
kiyer
4 REPLIES 4

jbarrez
Star Contributor
Star Contributor
One easy solution could be to have a dedicated machine for jobs.
Simply put up a server with an Activiti engine, but don't make it do 'regular' operation. Simply point it to the right database, and enable the job executor, and disable the job executor on the regular machines. You now have a dedicated way of handling jobs.

The requirement you state (send some job to a specific machine) is not possible out of the box. However, the job executor is pluggable and you can always write some custom code to solve your use case too (but first check if the 'quick-win' is not enough for you).

kiyer
Champ in-the-making
Champ in-the-making
Hi Joram,
Thank you for the guidance.
  1. Quick win scenario: Is it possible to enable the job executor on more than machine dedicated to this task? This is so that they can share the load of the jobs. If yes, then how do they coordinate amongst themselves so that they dont execute the same job at the same time?
  2.  
  3. Full win scenario: You mentioned job executor is pluggable. If there are any tutorials/unit tests/ Activiti API that you can point me to, I would be greatful.
Thanks for your tips,
kiyer

jbarrez
Star Contributor
Star Contributor
1. Sure thing. Just fire up two or more and they'll balance the jobs between themselves. Nothing extra is required. Do note you'll see an 'ActivitiOptimisticException' passing by in this setup. But that's to be expected: one of the job executors will try to get the job, but fails and gets an optimistic locking exception.

2. No, nothing written out there. But the jobexecutor is a simple bean that you can plugin into the ProcessEngineConfigurationImpl easily. Check the DefaultJobExecutor class to get an idea how this should work.

kiyer
Champ in-the-making
Champ in-the-making
Joram,
Appreciate your tips!

Thanks!
kiyer