cancel
Showing results for 
Search instead for 
Did you mean: 

Could multiple Activiti engines share one Repository?

mscai
Champ in-the-making
Champ in-the-making
If multiple Activiti engines share one Repository DB, are there any issues?
In this environment, could each Activiti engine work independently?
In this environment, how could I query tasks, process instances which belong to the current activiti engine? It seems ProcessInstanceQuery and TaskQuery don't  provide this functionality.

My use case is a HA system. There are some active processes. Each process contains one activiti engine, and execute workflow. There are other processes which are called as backup processes. These processes do nothing. If one active process crashes, there would be backup process selected. This backup process takes up the responsibility of the crashed active process. It start a activiti engine and continue to execute workflows.

My rough idea is each activiti engine contains an unique processEngineName. All activiti engine share the same repository DB. And each of them works independently. If one process crashes (its activiti engine must crash), the selected backup process starts a activiti engine with the same processEngineName, and then continue.
14 REPLIES 14

jbarrez
Star Contributor
Star Contributor
If multiple Activiti engines share one Repository DB, are there any issues?
In this environment, could each Activiti engine work independently?

Yes, no problem at all. That's how Activiti works in a clustered environment.

In this environment, how could I query tasks, process instances which belong to the current activiti engine? It seems ProcessInstanceQuery and TaskQuery don't provide this functionality.

What do you mean with 'current engine'. That doesnt seem like you want to have a common repository. If you want data per engine, you need to have a separate db per engine.

My use case is a HA system. There are some active processes. Each process contains one activiti engine, and execute workflow. There are other processes which are called as backup processes. These processes do nothing. If one active process crashes, there would be backup process selected. This backup process takes up the responsibility of the crashed active process. It start a activiti engine and continue to execute workflows.

With process you dont mean a BPM 'process', right?
Your use case would be much easier solved by running multiple Activiti engines in a cluster.

mscai
Champ in-the-making
Champ in-the-making
Yes, no problem at all. That's how Activiti works in a clustered environment.
I am new to Activiti. Could you tell me where could I get the doc or detailed instruction about Activiti in clustered environment, please?
Thank you.

What do you mean with 'current engine'. That doesnt seem like you want to have a common repository. If you want data per engine, you need to have a separate db per engine.

"Current engine" means the activiti engine owned by the current application.
I want a common repository for all activiti engine. 

With process you dont mean a BPM 'process', right?
Your use case would be much easier solved by running multiple Activiti engines in a cluster.

No, it is not a BPM 'process'. It is application.

jbarrez
Star Contributor
Star Contributor
I am new to Activiti. Could you tell me where could I get the doc or detailed instruction about Activiti in clustered environment, please?

Currently, no docs on that topic. But basically you can set up multiple engine on multiple web containers, and point them to the same database. We've made sure that works perfect out of the box.

"Current engine" means the activiti engine owned by the current application.
I want a common repository for all activiti engine.

So you want to split data for each applictation? Then I think it is easier to have a separate database for each application.

anupradhan
Champ in-the-making
Champ in-the-making
Seeing that the post was last year, are there any documents that provide detailed instruction about Activiti in clustered environment? I did not see anything in the user guide.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Read what jbarrez wrote… There is effectively nothing special to do, other than to have all engines in the 'cluster' point to te same db

erny18031
Champ in-the-making
Champ in-the-making
Read what jbarrez wrote… There is effectively nothing special to do, other than to have all engines in the 'cluster' point to te same db

Hmmm, I'm wondering if Activiti uses Hibernate and L2 Ehcache indirectly (through Spring). It seems that it currently doesn't.

I've looked into the source:
modules/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java

and it seems to use Ibatis / Mybatis.

Process definitions seem to be cached. What else?

What has to been taken into account (regarding any cached data) whenever a multi-node Activiti cluster is configured?

Regards.
Erny

trademak
Star Contributor
Star Contributor
Hi,

What's your reasoning for asking?
Because the process definitions are just cached for performance reasons. So every engine in the cluster will have these definitions cached.

Best regards,

erny18031
Champ in-the-making
Champ in-the-making
Hi,

What's your reasoning for asking?
Because the process definitions are just cached for performance reasons. So every engine in the cluster will have these definitions cached.

Best regards,

Hello.

Just thinking about scalabilty and clusterization issues.

What happens if a new process version is deployed on a node? Do the other nodes pick up automatically the new process definition when a new process instance is created?

I still have not a good knowledge about such details. I'll browse the code for it. Intuitively I would think that the cached process definition is only used for already running process instances.

Regards.
Erny

bwestrich
Champ in-the-making
Champ in-the-making
We are hoping to use Activiti in a clustered environment to ensure high availability. I'm glad to see jbarrez's note stating that Activiti is designed to be cluster-compatible out of the box. 

However, the Activiti roadmap (at http://docs.codehaus.org/display/ACT/Roadmap) has the following item on it:
"Test clustering (Tom)"
(though there is also a caveat on the roadmap page that the roadmap may be out of date).

Has Activiti yet been tested in a clustered environment?

In particular, we are not interested in the JobExecutor functionality (as we don't use timers). Most discussion related to clusters focuses on that. We are instead interested in the overall stability of Activiti in a cluster. Specifically, we wonder if there are multi-threaded synchronizations that occur in the Activiti Java code (e.g. Java synchronize blocks) to ensure process instances are not concurrently modified in invalid ways, and if so whether these synchronizations are supplemented with the database-based locking needed to ensure thread safeness across cluster nodes.