Open tobiasschaefer opened 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:
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.
Here is MyBatis together with GraalVM: https://github.com/mybatis/mybatis-3/issues/1552
Starting the Camunda process engine takes a few seconds. Let's analyze what is taking so long using e.g. inspectIT.