Why start Process Instance By Key And TenantId method is very slow?

Hi there,

Recently I’ve been using flowable with spring boot and I’m totally new to it :slight_smile:

My question is why calling startProcessInstanceByKeyAndTenantId method of org.flowable.engine.impl.RuntimeServiceImpl is very slow? It takes about 400 milliseconds and I think it is high!

Why is that and how could I fix that? please help me.

Thank you.

Hey @miladro,

The amount of time that it takes to start a process instance is dependent on what is done in that process instance. e.g. if you have a service task that takes 1 second after the process is started then starting a process instance will take at least 1 second.

The reason for this is that the start of a process instance will return once all the wait states that are defined are reached.

How does your model look like? Have you compared the performance to starting a process instance using only a definition id?

Cheers,
Filip

Hi @filiphr,

Thanks for your response. I test a process with just a start and end and it’s still slow. The code base that I’m working on is using the method that I’ve mentioned before (startProcessInstanceByKeyAndTenantId) and inside that method this.commandExecutor.execute(new StartProcessInstanceCmd(processDefinitionKey, (String)null, (String)null, variables, tenantId)); is executed.
I think whatever happens inside it is slow and I don’t have any other clue :confused:

Thank you.

We’ve benchmarked start->end (a while ago), see here: Flowable 6.3.0 Performance Benchmark. There we could get it to 1000’s/second. How is your setup looking? Which database? Which hardware?

(post deleted by author)

(post deleted by author)

Database: MongoDB 4.2

Hardware:

CPU: Intel Xeon E312xx 2.50 GHZ (8 processors)
RAM: 32 GB

As you can read on GitHub - flowable/flowable-mongodb, the mongodb integration was done a long time ago and is in alpha state at best (we haven’t got much interest in it using-wise nor contribution-wise), so the mongodb layer is absolutely not optimized (uses a 1-1 relational to json representation, etc.).