AnsweredAssumed Answered

Increasing performance

Question asked by alper on Nov 24, 2014
Latest reply on Nov 24, 2014 by pkonyves
Hi,
I have following idea:
I tested creation of engine, and I got that the most time consuming operations are:
1).
processEngine = ProcessEngineConfiguration
            .createStandaloneInMemProcessEngineConfiguration()
            .setDatabaseSchemaUpdate(
                  ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
            .setDataSourceJndiName("java:jboss/datasources/ActivitiDS")
            .setJobExecutorActivate(true).buildProcessEngine();

2).
repositoryService.createDeployment()
            .addClasspathResource("parent.bpmn")
            .addClasspathResource("paralel.bpmn").deploy()………..<any other bpmn needed>;


Is that safe to do it once, store as static, and after that reuse these resources? According to my test yes, but I would like any confirmation from the Activiti developers, you know, to be on the safe side…

So my app has init() method that looks like:

private void init() {
      processEngine = ProcessEngineConfiguration
            .createStandaloneInMemProcessEngineConfiguration()
            .setDatabaseSchemaUpdate(
                  ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
            .setDataSourceJndiName("java:jboss/datasources/ActivitiDS")
            .setJobExecutorActivate(true).buildProcessEngine();

      runtimeService = processEngine.getRuntimeService();

      RepositoryService repositoryService = processEngine
            .getRepositoryService();
      
      repositoryService.createDeployment()
            .addClasspathResource("parent.bpmn")
            .addClasspathResource("paralel.bpmn").deploy();
   }


After that, each time I invoke the workflow, I just do it in the separate method:

runtimeService.startProcessInstanceByKey(processId, request);


Will it work ok this way, or some of those resources I mentioned in the init() I need to re-initialize each time I need the new workflow?

Thank you.

Outcomes