Our application runs on webshere application server 7 (JEE5) and has urgent requirement to support clustered environment. That is 2 clones will be running to support our application. We have been using jBPM (with persistence) and during testing ran into a problem with optimistic locking when jBPM request are distributed to different servers. Even during starting any jBPM process, statefulKnowledgeSession.startProcess method call runs into problems because some other clone has potentially updated the SessionInfo. Also for different servers, we're using same SessionInfo id to create StatefulKnowledgeSession instance.
Basically, ksession = JPAKnowledgeService.loadStatefulKnowledgeSession(1, kbase, config, env); is used on all the clones. Currently we have two clones, but can have potentially more in future.
We're creating StatefulKnowledgeSession during server startup of each node. Code for creating this session is very similar to what's in the jBPM document. In addition, we are also using human task server by using MinaTaskServer, which is also started during server startup.
Can the community please suggest some best practices to make jBPM run in clustered environment. Below are some of the links that we have been using but not sure what's the best approach for supporting clustered environment.
I think one of the options we have is to have StatefulKnowledgeSession per process instance. What does community think about that?
Any concerns with that approach? I think it can have some performance implications due to starting and disposing the session for each request to jBPM. But I think it will work.