Skip to main content

Why QuantumBPM 2.0 No Longer Runs on Temporal

· 10 min read
Richard Bízik
Founder of QuantumBPM
Jakub Krištof
BPMN Engine Engineer

QuantumBPM 2.0.0, released on November 2, no longer runs on Temporal. The BPMN engine now runs inside the QuantumBPM backend and keeps all of its state in PostgreSQL.

In short
  • Fewer components. A deployment is two application images and PostgreSQL. No Temporal cluster, and no extra databases for it.
  • About ten times the throughput on the same hardware, because the engine does a fraction of the database work per process step.
  • One consistent record. An instance's state, its tasks and its history are written together, so they cannot disagree after a failure.
  • Standard operations. High availability, backups, restores and retention all run on PostgreSQL, with tooling your team already uses.

In April we published BPMN on Temporal: Durable Execution Without Writing Your Own. It argued that durable execution, keeping long-running work alive through crashes and restarts, is a solved problem, and that our effort belonged in BPMN, DMN and the modeler rather than in storage.

That was the right call for a first version. Temporal gave 1.x durable timers, retries and crash recovery from the first day, and we would make the same choice again. Running 1.x under sustained load and with long-running processes then showed where a BPMN engine and Temporal pull in different directions. This post explains what we changed and what it means if you run QuantumBPM.

Why Temporal no longer fit​

Temporal makes code durable by recording every decision the code makes, and after a failure, re-running the code against that record. That is the right design for workflows written as code. A BPMN engine is different: the state of a process instance, where it is in the model, which tasks are open, the values of its variables, is already data the engine keeps anyway. So 1.x kept every instance twice, once as its own state and once as Temporal's history. That had four consequences.

Cost. Under load, 1.x ran 28 transactions in Temporal's database for every job of a process, about twelve for every transaction of its own. At saturation, Temporal and its database took roughly three quarters of the CPU. Most of the hardware went into bookkeeping rather than into running processes. The best we reached on a single 24-core benchmark node was about 80 process instances per second, and only after tuning Temporal's rate limits and topology.

Consistency. Instance state lived in Temporal, while jobs, user tasks and our history lived in the application database. No transaction covered both, so every failure path needed its own logic to bring them back in line. That is work an engine should not need, and it is where hard-to-reproduce incidents come from.

Upgrade risk. Temporal recovers an instance by re-running the engine's code against its recorded history. An engine update that changed what the engine records could therefore break instances that were already running, and only a dedicated replay test suite could catch it. This weighed most on the processes BPM exists for, the ones that wait weeks or months for a customer, a document or an approval. Those also needed periodic rotation to stay within Temporal's history limits, which was some of the most delicate code we had.

Operations. Temporal was a dependency you brought yourself: four services, a persistence database and a visibility database, each with its own scaling settings, retention and upgrade cycle. Some choices were fixed at install time. The number of history shards cannot change after a Temporal cluster is created, and the stock default capped our benchmark at about 27 instances per second. On a SQL database, all of Temporal's state goes to one database server, and scaling past that means moving to Cassandra.

None of this is unreasonable for a general platform. It was a lot to ask of someone who wanted an easy to run BPMN engine.

Architecture, before and after​

1.x on Temporal​

2.0 on PostgreSQL​

Both versions also run the web UI and sign users in through your OIDC identity provider. Those parts did not change.

How 2.0 works​

One writer per instance. Process instances are spread over partitions, and the backend replicas share the partitions between them. Only the replica that owns a partition advances its instances, one step at a time. API calls and other instances never change an instance directly. They leave an event in its inbox, and the owner processes it next. This is the one idea we kept from Temporal on purpose. Engines where any server may update any instance have to detect conflicting updates and retry them, which Camunda 7 users know as OptimisticLockingException. In QuantumBPM, API calls never conflict with each other or with the engine.

One transaction per step. Each step commits the instance's new state together with its history, jobs, user tasks, incidents and outgoing messages in a single PostgreSQL transaction. Either all of it happened or none of it did. There is no second store for anything to disagree with.

Reliable delivery between instances. Call activities, messages, signals and operator commands are written to an outbox in that same transaction, then relayed to the receiving instance with duplicate protection. A crash in between delays a delivery but never loses it or delivers it twice.

Failover in seconds. A replica that shuts down hands its partitions to the others. If one crashes, its partitions move once their leases run out, within about 10 seconds, and its instances continue on another replica. Committed work is never lost, and work that did not commit left nothing half done.

Scaling in two directions. More replicas add processing capacity. When one database is no longer enough, additional PostgreSQL databases, called shards, each take a share of the partitions. In one benchmark, a second shard took throughput from 281 to 533 instances per second.

History and retention. Every instance keeps a complete history of what it did and when, and every entry records the user or service account whose call caused it. Deployed versions, started instances and completed tasks record who did it too. Ended instances are deleted with their history after a retention period, 90 days by default and configurable per project.

The numbers​

We benchmark on a single node on purpose: it shows what one server does before replicas and shards spread the load. Both versions ran the same process with 11 automated tasks on the same 24-core node, and both were limited by its CPU. The setups were not identical, so read these as orders of magnitude rather than as a controlled comparison.

1.x on Temporal2.0 on PostgreSQL
Process instances per second~80~700 to 800
Automated tasks (jobs) per second~920~8,000
CPU time per job~22 ms~1.5 ms
What you runbackend, Temporal cluster, PostgreSQLbackend, PostgreSQL

In practical terms, the same process volume needs roughly a tenth of the compute, and one server has about ten times the headroom before you need to scale out.

What it means for you​

  • Fewer components to run, secure and patch. Two application images and PostgreSQL, deployed with our Helm chart on Kubernetes or OpenShift. No Temporal cluster and no extra databases for it.
  • Skills you already have. The engine's state is PostgreSQL tables. Your database team monitors, sizes and operates it like any other PostgreSQL workload.
  • Backups and disaster recovery with standard tooling. PostgreSQL backups work as they are, for example with CloudNativePG. With several shards, the engine creates named restore points on all of them, so they restore to the same moment.
  • High availability without manual recovery. Run two or more replicas, and the work of a failed one moves to the others within about 10 seconds.
  • A record you can audit. State, tasks and history are written together, and every history entry names who caused it. Retention is one setting, adjustable per project.
  • Observability. Engine metrics cover steps, timers, jobs and workers, and traces follow an instance through its steps and jobs.
  • Predictable sizing. Scaling the engine explains when to add replicas and when to add shards.

Your process models carry over.

Trade-offs​

  • The engine is ours to maintain. In April we argued against exactly that. We back it the way any engine vendor has to: an end-to-end test suite that runs on several databases at once, a fuzzer that generates processes and checks the engine's results, and soak tests at maximum load.
  • Adding a shard needs a maintenance window. Moving partitions to a new shard runs with every replica stopped, so plan shards ahead of growth.
  • Upgrading from 1.x is a migration. 2.0 starts on a new database, and a migration script supplied by support moves the 1.x data into it. The upgrade notes cover the steps.
  • No reuse of an existing Temporal cluster. Teams that already ran Temporal could fit 1.x into it. 2.0 brings its own runtime and connects to the rest of your systems through its REST API and SDKs for TypeScript, Python, Java and Go.

Would we do it again?​

Yes, both halves of it. Starting on Temporal put a working, durable BPMN engine in front of users while we learned what the engine had to be. Once we knew, an instance's saved state turned out to be the only durable record we needed, and saving it in one transaction did the job of an event history and its replay.

If your teams write workflows as code, Temporal remains an excellent choice. If your processes are modeled in BPMN, the model already describes the state, and a database transaction may be all the durability it needs.

If you are evaluating QuantumBPM reach us at support@quantumbpm.com.

Frequently Asked Questions​

Why did QuantumBPM stop using Temporal?

Temporal makes code durable by replaying a recorded history. A BPMN engine already keeps each instance's state as data, so 1.x stored every instance twice. That cost about 28 Temporal database transactions per job, split each instance over stores that could disagree after a failure, and made every engine update a compatibility risk for running instances. 2.0 writes each step in one PostgreSQL transaction.

What does QuantumBPM 2.0 need to run?

The backend and web UI images, a PostgreSQL database and your OIDC identity provider. The Helm chart deploys it on Kubernetes or OpenShift. No Temporal cluster is needed.

How does QuantumBPM 2.0 scale?

Add backend replicas for processing capacity. When the database becomes the limit, add PostgreSQL databases as shards, each taking a share of the instances. See Scaling the engine.

What happens when a server fails?

Its share of the instances moves to the remaining replicas within about 10 seconds. Every committed step is kept, and a step that did not commit left nothing behind, so no manual recovery is needed.

Can we upgrade a QuantumBPM 1.x installation to 2.0?

Yes. 2.0 starts on a new database, and a migration script moves the 1.x data into it. The upgrade notes list the steps and the changes to the API, the SDKs and the models.