Camunda in load balancing situation

For our application we have configured load balancer and lets say there are two machines A and B.
We have a requirement like when a flow is executed the user could save the state and log in again the next day, but if the user is directed to machine B through load balancing, still the user should continue at the sate at which he left in machine A.
How can this be achieved ?

Hi Ranjith,

please give a bit more information of your scenario.
What do you mean by state. The state of a process instance?

Best regards,

markus

Process Instance State is persisted in database.
If Node A and Node B pointing on same database the user will always see the same state of the process instance.

Is ist what you mean?

Best regards,

Markus

1 Like

Hi markus

yes this is what i mean.
But We are not allowed to have a separate server for database.
Each machine should have its own database.
does camunda allow a distributed database i.e the contents of database can be replicated across all the load balanced machines ?

Hi Ranjith,

Concerning to documentation https://docs.camunda.org/manual/7.6/introduction/architecture/#clustering-model
this is not possible.

But I am not 100% percent sure here.

3 Likes

Wow this forum really nice thankyou so much

I am 100% sure that you cannot use a clustered database that is not at what is known as a READ COMMITTED isolation level. The only one supported is MariaDB/Galera and that is only for reliability, not scaling.

Simply put, Camunda wants to see a single, monolithic database that is completely consistent. If you attempt to use a replication architecture like MySQL MASTER-MASTER replication, you are asking for trouble unless you can absolutely guarantee consistency between the two instances. This would essentially be fully synchronous replication and I doubt even that would be supported.

1 Like

Hi manu

So you mean the following architecture is not permissible?

where the two machines are load balanced and when the user executes the flow in machine A and returns the next day where the load balancer directs the user to the machine B and the user should resume the flow execution from the sate in which he left it the previous day.
From your answer if i use the above architecture my scenario will not work out?

Thanks

Hi Manu

And Do you suggest that the below is the only architecture that is permissible and that my scenario will work?

At this time, the only supported database architecture for Camunda is one where both READ and WRITE nodes are 100% consistent all of the time. You could use a load balancer if your master-master replication is truly synchronous and is configured for READ COMMITTED isolation.

Think of it this way, when Camunda reads the database, it expects that the values returned from the query are 100% up-to-date. In your scenario, one Camunda server could write to database A through the load balancer and then another query could to read the database could be sent to database B. During that brief interval, if the transaction written to database A, which changes the “state” of database as Camunda wants to see it, had not yet been written to database B, then Camunda could get the wrong value.

The assumption in Camunda is that the database will always be atomically consistent, which simply means that no matter which node you read from, it will be identical to the state of every other node. This is not possible with the configuration you are attempting to use.

There is one scenarios where you could use a load balancer and that is for reporting. If you also use the Camunda database to generate reports, then you can probably tolerate a small amount of inconsistency in your reads. In that case you could use a load balancer on the database for that and that alone.

1 Like

Hi manu

Not sure if I conveyed the scenario the right way, just want to clarify one thing.
The two machines will run two separate process engine.

The architecture is as follows.

It doesn’t matter, Ranjith. The database that any Camunda engine uses must use a READ COMMITTED isolation level. There is simply no way around this if you want reliable operation. If you consider the consequences of inconsistency between the databases, which you cannot avoid using most clustering solutions, you will understand why Camunda requires this.

If you enable fully synchronous replication and the database is configured for a READ COMMITTED isolation level, then it should, in theory, work. However, Camunda would need to certify such a configuration and the only one certified so far is MariaDB/Galera using a READ COMMITTED isolation level AND accessing only ONE node of the cluster. You cannot distribute reads or writes to other nodes. The other nodes are only there for quick failover. Others may disagree with this statement, but we have tested this extensively and found it to be the case.

4 Likes

Thanks an lot manu for your answers.

Hi @Ranjith_Kannan,

a complete different approach would be to use an intelligent load balancer to stick each User/Process to a certain installation. Zalando does this with a mapping table on the load balancer.

You can find more details here: https://blog.camunda.org/post/2015/03/camunda-meets-cassandra-zalando/

Hope this helps,

Ingo