-
1. Re: can JBPM engine execute multiple processes in parallel?
wdfink May 29, 2014 6:40 AM (in response to meenal)Beginner's Corner looks not the right place to get an answer for this, I move it to a better place
-
2. Re: can JBPM engine execute multiple processes in parallel?
krisverlaenen Jun 1, 2014 6:59 PM (in response to meenal)Yes, multiple processes can be executed in parallel.
The easiest way to use a runtime manager with a strategy per request or per process instance, which will instantiate a different ksession per request / per process instance, and there requests will be executed in parallel. See Chapter 5. Core Engine API
When only using one ksession , this will also be achieved by using asynchronous service tasks (same way as for example human tasks are executed). This will execute the service task using independent threads. As a result, other requests can be executed while waiting for the results of the first. You can use the jBPM executor for setting up asynchronous service tasks.
-
3. Re: can JBPM engine execute multiple processes in parallel?
meenal Jun 2, 2014 7:58 PM (in response to krisverlaenen)thanks for the reply.
i created a simple process that has just one script task using the jbpm console . i have added a sleep in the script task so that process execution takes more than 25 seconds.
i created the deployment to use PER_REQUEST runtime strategy.
now i opened 2 separate command line windows to start 2 instances of the process in parallel:
curl -X POST -H "Accept:application/json" -u admin:admin http://localhost:8080/jbpm-console/rest/runtime/vrts.vom.plans:recoveryplan:1.0/process/recoveryplan.rplan/start
when i start the second instance using the same command in another window (before the first instance completes) i m getting the following exception:-
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response>
<status>FAILURE</status>
<url>/jbpm-console/rest/runtime/vrts.vom.plans:recoveryplan:1.0/process/recoveryplan.rplan/start</url>
<error>org.hibernate.exception.GenericJDBCException: Timeout trying to lock table "PROCESSINSTANCEINFO"; SQL statement:
insert into ProcessInstanceInfo (InstanceId, lastModificationDate, lastReadDate, processId, processInstanceByteArray, startDate, state, OPTLOCK) values (null, ?, ?, ?, ?, ?, ?, ?) [50200-161]</error>
<stackTrace>javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Timeout trying to lock table "PROCESSINSTANCEINFO"; SQL statement:
insert into ProcessInstanceInfo (InstanceId, lastModificationDate, lastReadDate, processId, processInstanceByteArray, startDate, state, OPTLOCK) values (null, ?, ?, ?, ?, ?, ?, ?) [50200-161]
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361)
Looks like it is timing out while locking table PROCESSINSTANCEINFO. i was hoping to see them both executed in parallel. what am i missing?
observed the same behavior with PER_PROCESS_INSTANCE runtime strategy as well.
-
4. Re: can JBPM engine execute multiple processes in parallel?
krisverlaenen Jun 2, 2014 8:17 PM (in response to meenal)Depending on what database configuration you use, you might have to add an index on the process instance info table (column id) to avoid it to lock the entire process instance info table.
-
5. Re: can JBPM engine execute multiple processes in parallel?
meenal Jun 2, 2014 9:54 PM (in response to krisverlaenen)i m using the default database that comes with the demo setup. does it not support row level locking?
-
6. Re: can JBPM engine execute multiple processes in parallel?
krisverlaenen Jun 3, 2014 7:18 PM (in response to meenal)Indexes are not always created when auto-generating the database (depending on the database etc.). For these types of tests, it would be recommended to use a more realistic production database (not pure in memory), which will allow you to add indexes if necessary.