Cache the definitions found by parent deployment and key by filiphr · Pull Request #4312 · flowable/flowable-engine · GitHub
Skip to content

Cache the definitions found by parent deployment and key - #4312

Open
filiphr wants to merge 4 commits into
flowable:mainfrom
filiphr:same-deployment-definition-cache
Open

filiphr wants to merge 4 commits into
flowable:mainfrom
filiphr:same-deployment-definition-cache

Conversation

@filiphr

@filiphr filiphr commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Looking up a definition by parent deployment id and key (starting a process or case instance with a parent deployment id, the call activity, process task and case task with same deployment, and the BPMN business rule task and CMMN decision task) ran the parent deployment query every time. The id of the found definition is now kept in a cache per parent deployment (or deployment) and key, so a hit no longer runs that query.

  • Process definitions: a cached id is checked by selecting the definition by id.
  • Case definitions and decisions: by default a cached id is checked by selecting the definition by id, so a definition that was undeployed on another node is detected. With verifyCachedSameDeploymentDefinitions disabled on the CMMN or DMN engine configuration, the definition is taken from the definition cache without a select.
  • Misses of the parent deployment lookup are only cached when the new cacheSameDeploymentDefinitionMisses is enabled (disabled by default), because in a cluster a node that did not do the deployment would keep the miss when a new child deployment is added under an existing parent. Misses of the call activity lookup are always cached.
  • A cached miss applies to the tenant it was recorded for.
  • Deploying and removing a deployment evicts the entries of its definition keys.
  • The cache uses the definition cache limit of the engine and can be replaced through setSameDeploymentDefinitionCache.

The last commit fixes the ProfilingDbSqlSessionFactory used by the database operation count tests. DbIdGenerator fetches a new id block through the process engine command executor, so when a command of another engine was profiled, the next.dbid select was counted for that command whenever the id block ran out during it.

Check List:

  • Unit tests: YES
  • Documentation: NA

…t and key

Starting a process instance with a parent deployment id, the CMMN process task with same deployment and the call activity with same deployment now cache the id of the found process definition. A cached id is checked by selecting the definition by id, so the parent deployment query does not run again.

Misses of the parent deployment lookup are only cached when cacheSameDeploymentDefinitionMisses is enabled; misses of the call activity lookup are always cached. Deploying and removing a deployment evicts the entries of its definition keys.
Starting a case instance with a parent deployment id, the CMMN case task with same deployment and the BPMN case task now cache the id of the found case definition. By default a cached id is checked by selecting the definition by id; with verifyCachedSameDeploymentDefinitions disabled the definition is taken from the case definition cache.

Deploying and removing a deployment evicts the entries of its case definition keys.
Executing a decision with a parent deployment id, which includes the BPMN business rule task and the CMMN decision task, now caches the id of the found decision. The deployment query by parent and the decision select no longer run on a hit. By default a cached id is checked by selecting the decision by id; with verifyCachedSameDeploymentDefinitions disabled the decision is taken from the decision cache.

Deploying and removing a deployment evicts the entries of its decision keys.
…factory

The DbIdGenerator fetches the next id block through the process engine command executor.
When a command of another engine is profiled, the select of the id block was attributed to that command.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant