Problem using 2 servers and one database

Hello guys,

Could you please help me with this problem?
The situation is: I’m trying to execute a stress test with embedded Camunda Engine Workflow (a simple one) and I’m using 2 servers looking for the same database.
When I try this case, I receive the following error:

org.camunda.bpm.engine.OptimisticLockingException: ENGINE-03005 Execution of 'UPDATE PropertyEntity[next.dbid]' failed. Entity was updated by another transaction concurrently.
at org.camunda.bpm.engine.impl.db.EnginePersistenceLogger.concurrentUpdateDbEntityException(EnginePersistenceLogger.java:130)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperations(DbEntityManager.java:345)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flushDbOperationManager(DbEntityManager.java:314)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.flush(DbEntityManager.java:286)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:203)
at org.camunda.bpm.engine.impl.interceptor.CommandContext.close(CommandContext.java:132)
at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:113)
at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
at org.camunda.bpm.engine.impl.db.DbIdGenerator.getNewBlock(DbIdGenerator.java:46)
at org.camunda.bpm.engine.impl.db.DbIdGenerator.getNextId(DbIdGenerator.java:38)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.ensureHasId(DbEntityManager.java:585)
at org.camunda.bpm.engine.impl.db.entitymanager.DbEntityManager.insert(DbEntityManager.java:468)

Camunda Version: 7.8.0
Database Version: PostgreSQL 9.6.6

Thank you!
Best regards,

Robert

Hi @Robert_Cavalcante,

don’t worry. OptimisticLockExceptions are quite normal. Please have a look at the docs.

Best regards,
Philipp

1 Like

Hi @Philipp_Ossler,

We’re doing a stress test using 10 threads with 1000 request each one, and 10% of the total is happening this problem.
Looking the logs, we saw that this 10% is not executing the whole workflow. Is there a way to minimize this error?

Thanks!
Robert

Hi @Robert_Cavalcante,

the OLEs can have different reasons.

First, please check that you use the StrongUuidGenerator to generate the ids. In the previous post, it seems that you use the database id generator which is not recommended.

Best regards,
Philipp

2 Likes

Hi @Philipp_Ossler,

I was with the same problem. Thanks, solved for me.

@Philipp_Ossler,

This solution worked for me!

Thanks!

Best regards,
Robert

Hi Team,

We are also facing the same situation with the database ID generator. And, we came to know that the UUID generator helps with the high level of concurrency.

However, we would like to understand it better from the Camunda team for the reasoning behind proposing the UUID generator and not keeping the separate numeric sequence generator for each table( generally Oracle does the same thing and MySQL maintains implicit sequencing for each table). Since numeric primary id will give better performance with indexing.

  1. We are a bit surprised that Camunda had a single UUID generator for all tables even when the tables are not related - Instance table, Task table, etc. Why would I need a unique ID across tables? The primary key is only table-specific.
  2. Why would Camunda generate an alphanumeric UUID and that also 25 characters? This is a nightmare in the making. The index on the primary key is going to be extremely slow.
  3. Why are we not leveraging database id generation for a unique primary key generation? Databases have the best transaction handling - Why do we need to reinvent the wheel?

Thanks,
Best regards,
Dipak