Best practices to start multiples process instances

Hi,

We are using Camunda in our software with the REST API.

From our software we are starting multiples process instances using Start Process Instance | docs.camunda.org

The problem is we can have sometimes hundreds of instances to start at the same time.
We didn’t find a way to start all theses instances without calling the API multiple times.

After a number of API calls Camunda is throwing some exceptions like :

Error querying database. Cause: org.apache.ibatis.transaction.TransactionException: Error configuring AutoCommit. Your driver may not support getAutoCommit() or setAutoCommit().

or

org.camunda.bpm.engine.rest.exception.RestException: Cannot instantiate process definition xxxxxxxxx:11:68a0f7a3-966e-11ea-92a3-ca1c9615904e: Process engine persistence exception
at org.camunda.bpm.engine.rest.sub.repository.impl.ProcessDefinitionResourceImpl.startProcessInstance(ProcessDefinitionResourceImpl.java:125)

Is there any good practices / advices to execute a batch process instances creation ?

Thanks in advance!

@Benjamin_Bellantonio which database are you using?

Make sure db isolation is level been set to READ COMMITTED

I am using MySQL, will update the configuration tomorrow if not like that. Do you have any advice for the multi start instances ? Or there is no other way to do it?

DB isolation is correctly setup.

@Benjamin_Bellantonio, to start multiple instances i would recommend to model multi instance subprocess, and pass the list input which will loop through and start multiple instances.

To configure the multi-instance activity, refer the below post:

Thanks for the reply, I thought about this solution but we are not planning to rework the BPMN entiererly to make it work in sub process.

In our system an instance is a single instance which modelize a single ‘Employee’ (even if there is subprocess also for this workflow).

Another solution could be to use JAVA api maybe to handle that case differently ?

@Benjamin_Bellantonio, you can use Java API to perform bulk batch processing to start the instances.

And you can refer this solution also:

Thanks a lot for your response, will have to find what is the best for us now :slight_smile:

Hi @Benjamin_Bellantonio,

the best way to start as many processes as possible is to include as less logic into the process before it is saved to the database for the first time…

The easiest way to reach that goal is mark every process model with Asynchronous before on the start event.

Hope this helps, Ingo

2 Likes