camunda-community-hub / micronaut-camunda-platform-7

Integration between Micronaut and Camunda (Workflow Engine). We configure Camunda with sensible defaults, so that you can get started with minimum configuration: simply add a dependency in your Micronaut project to embed the workflow engine!
https://camunda.com/blog/2021/07/automate-any-process-on-micronaut/
Apache License 2.0
74 stars 29 forks source link

Performance-Analysis of Camunda Process Engine #19

Open tobiasschaefer opened 4 years ago

tobiasschaefer commented 4 years ago

Starting the Camunda process engine takes a few seconds. Let's analyze what is taking so long using e.g. inspectIT.

tobiasschaefer commented 4 years ago

I analyzed this with inspectIT: https://github.com/inspectIT/inspectIT/releases

Starting the process engine takes about 5,5 seconds on my laptop. Of that time MyBatis already needs 3,5 seconds to parse the XML mappings. Camunda needs 53 mappings - some of them need several hundred milliseconds to parse and this then sums up to multiple seconds.

Camunda 7.13.0-alpha4 still has the same issue.

Here is a good introduction on Camunda and its usage of MyBatis: https://docs.camunda.org/manual/7.7/examples/tutorials/custom-queries/ The documention is for version 7.7 because the chapter seems to have been removed in the current documentation. I don't know how much is still relevant but it might help.

Here are the invocation sequences as recorded by inspectIT:

callstack1

callstack2

callstack3

tobiasschaefer commented 4 years ago

I pushed a commit to the branch https://github.com/tobiasschaefer/micronaut-camunda-bpm/tree/issue19-startup-time

Reduced startup from 5 seconds to about 2.1 seconds by removing all unneeded mappers. This is not a solution but shows that the mappers are the problem. Note: setting lazyLoadingEnabled=true does not seem to have any influence.

Note: lazyLoadingEnabled is not related to loading of the mappings but to the relations between entities: https://mybatis.org/mybatis-3/configuration.html

I think we need to find a way to reduce the number of mappers loaded on startup or initialize them in parallel.

tobiasschaefer commented 3 years ago

Here is MyBatis together with GraalVM: https://github.com/mybatis/mybatis-3/issues/1552