Alfresco
  1. Alfresco
  2. ALF-3587

jBPM Hibernate cache strategy settings not used in Alfresco

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 3.3g Community
    • Fix Version/s: Future
    • Component/s: Workflow
    • Security Level: external (External user)
    • Labels:
      None
    • Resource:
      External

      Description

      The jBPM distribution has a hibernate.cfg.xml file that gives the location of mapping files and sets caching strategies for jBPM classes and collections. The cache strategy settings were not copied over into Alfresco's sessionFactoryBase bean. The effect is that the Hibernate second level cache is not used for jBPM objects and collections. Task dashlets end up taking a long time to load.

      See also ALF-1787.

        Issue Links

          Activity

          Hide
          Steve Rigby added a comment -

          Is there anything to do here, with the removal of hibernate?

          Show
          Steve Rigby added a comment - Is there anything to do here, with the removal of hibernate?
          Hide
          Derek Hulley added a comment -

          Implementation required:

          We know that the session factory does not have declarations for all the JBPM caches. The list is long.
          Start Alfresco with a breakpoint at:
          org.hibernate.cache.CacheFactory line 34
          This will break each time Hibernate checks if a cache has been defined. Record ALL the 'regionName' values.
          Then add them to the 'sessionFactoryBase' bean e.g.

          <property name="entityCacheStrategies" >
          <props>
          ...
          <prop key="org.jbpm.module.def.ModuleDefinition">$

          {cache.strategy}</prop>
          ...
          </props>
          </property>
          <property name="collectionCacheStrategies" >
          <props>
          ...
          <prop key="org.jbpm.graph.node.ProcessState.variableAccesses">${cache.strategy}

          </prop>
          ...
          </props>
          </property>

          Notice the different naming convention between entity and collection region names.
          The actual cache used will be a clone of the defaultCache (InternalEhCacheManagerFactoryBean.buildCache).

          Test workflow (unit tests and manual tests).

          Show
          Derek Hulley added a comment - Implementation required: We know that the session factory does not have declarations for all the JBPM caches. The list is long. Start Alfresco with a breakpoint at: org.hibernate.cache.CacheFactory line 34 This will break each time Hibernate checks if a cache has been defined. Record ALL the 'regionName' values. Then add them to the 'sessionFactoryBase' bean e.g. <property name="entityCacheStrategies" > <props> ... <prop key="org.jbpm.module.def.ModuleDefinition">$ {cache.strategy}</prop> ... </props> </property> <property name="collectionCacheStrategies" > <props> ... <prop key="org.jbpm.graph.node.ProcessState.variableAccesses">${cache.strategy} </prop> ... </props> </property> Notice the different naming convention between entity and collection region names. The actual cache used will be a clone of the defaultCache (InternalEhCacheManagerFactoryBean.buildCache). Test workflow (unit tests and manual tests).
          Hide
          Derek Hulley added a comment -

          Ken,
          Do you have a copy of the cache strategies that you used?

          Show
          Derek Hulley added a comment - Ken, Do you have a copy of the cache strategies that you used?
          Hide
          Daniel Gradecak added a comment -

          Hi Derek,

          as we are facing the same issue a colleague of mine found the cache strategies but we do not have any better performances.

          <property name="collectionCacheStrategies" >
          <props>
          <prop key="org.jbpm.graph.node.TaskNode.tasks">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.node.Decision.decisionConditions">${cache.strategy}

          </prop>
          <prop key="org.jbpm.graph.def.Transition.events">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.taskmgmt.exe.TaskInstance.pooledActors">${cache.strategy}

          </prop>
          <prop key="org.jbpm.taskmgmt.def.Swimlane.tasks">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.def.ExceptionHandler.actions">${cache.strategy}

          </prop>
          <prop key="org.jbpm.taskmgmt.exe.SwimlaneInstance.pooledActors">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.def.Event.actions">${cache.strategy}

          </prop>
          <prop key="org.jbpm.taskmgmt.def.TaskController.variableAccesses">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.def.SuperState.nodes">${cache.strategy}

          </prop>
          <prop key="org.jbpm.graph.def.Node.leavingTransitions">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.node.ProcessState.variableAccesses">${cache.strategy}

          </prop>
          <prop key="org.jbpm.taskmgmt.exe.TaskInstance.variableInstances">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.def.ProcessDefinition.events">${cache.strategy}

          </prop>
          <prop key="org.jbpm.bytes.ByteArray.byteBlocks">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.taskmgmt.def.Task.events">${cache.strategy}

          </prop>
          <prop key="org.jbpm.taskmgmt.exe.TaskMgmtInstance.swimlaneInstances">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.context.exe.ContextInstance.tokenVariableMaps">${cache.strategy}

          </prop>
          <prop key="org.jbpm.context.exe.TokenVariableMap.variableInstances">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.exe.ProcessInstance.runtimeActions">${cache.strategy}

          </prop>
          <prop key="org.jbpm.logging.log.CompositeLog.children">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.def.ProcessDefinition.exceptionHandlers">${cache.strategy}

          </prop>
          <!-- <prop key="org.jbpm.graph.action.Script.variableAccesses">$

          {cache.strategy}</prop>-->
          <prop key="org.jbpm.graph.exe.Token.comments">${cache.strategy}

          </prop>
          <prop key="org.jbpm.graph.def.Node.events">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.def.ProcessDefinition.definitions">${cache.strategy}

          </prop>
          <prop key="org.jbpm.graph.exe.Token.children">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.file.def.FileDefinition.processFiles">${cache.strategy}

          </prop>
          <prop key="org.jbpm.taskmgmt.exe.TaskMgmtInstance.taskInstances">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.def.Transition.exceptionHandlers">${cache.strategy}

          </prop>
          <prop key="org.jbpm.taskmgmt.def.Task.exceptionHandlers">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.def.ProcessDefinition.nodes">${cache.strategy}

          </prop>
          <prop key="org.jbpm.taskmgmt.exe.PooledActor.taskInstances">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.taskmgmt.exe.TaskInstance.comments">${cache.strategy}

          </prop>
          <prop key="org.jbpm.graph.def.ProcessDefinition.actions">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.def.Node.arrivingTransitions">${cache.strategy}

          </prop>
          <prop key="org.jbpm.graph.def.Node.exceptionHandlers">$

          {cache.strategy}</prop>
          <!--<prop key="org.jbpm.taskmgmt.def.TaskMgmtDefinition.tasks">${cache.strategy}

          </prop> -->
          <prop key="org.jbpm.graph.exe.ProcessInstance.instances">$

          {cache.strategy}</prop>
          </props>
          </property>

          <property name="entityCacheStrategies" >
          <props>
          <prop key="org.jbpm.graph.def.Node">${cache.strategy}

          </prop>
          <prop key="org.jbpm.logging.log.ProcessLog">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.context.exe.VariableInstance">${cache.strategy}

          </prop>
          <prop key="org.jbpm.instantiation.Delegation">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.def.ProcessDefinition">${cache.strategy}

          </prop>
          <prop key="org.jbpm.graph.exe.Token">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.taskmgmt.exe.PooledActor">${cache.strategy}

          </prop>
          <prop key="org.jbpm.graph.def.Transition">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.module.exe.ModuleInstance">${cache.strategy}

          </prop>
          <prop key="org.jbpm.taskmgmt.exe.TaskInstance">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.exe.RuntimeAction">${cache.strategy}

          </prop>
          <prop key="org.jbpm.graph.def.Action">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.module.def.ModuleDefinition">${cache.strategy}

          </prop>
          <prop key="org.jbpm.context.exe.TokenVariableMap">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.def.ExceptionHandler">${cache.strategy}

          </prop>
          <prop key="org.jbpm.job.Job">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.exe.ProcessInstance">${cache.strategy}

          </prop>
          <prop key="org.jbpm.taskmgmt.def.Task">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.def.Event">${cache.strategy}

          </prop>
          <prop key="org.jbpm.bytes.ByteArray">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.context.def.VariableAccess">${cache.strategy}

          </prop>
          <prop key="org.jbpm.taskmgmt.def.TaskController">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.graph.exe.Comment">${cache.strategy}

          </prop>
          <prop key="org.jbpm.taskmgmt.def.Swimlane">$

          {cache.strategy}</prop>
          <prop key="org.jbpm.taskmgmt.exe.SwimlaneInstance">${cache.strategy}

          </prop>
          </props>
          </property>

          Show
          Daniel Gradecak added a comment - Hi Derek, as we are facing the same issue a colleague of mine found the cache strategies but we do not have any better performances. <property name="collectionCacheStrategies" > <props> <prop key="org.jbpm.graph.node.TaskNode.tasks">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.node.Decision.decisionConditions">${cache.strategy} </prop> <prop key="org.jbpm.graph.def.Transition.events">$ {cache.strategy}</prop> <prop key="org.jbpm.taskmgmt.exe.TaskInstance.pooledActors">${cache.strategy} </prop> <prop key="org.jbpm.taskmgmt.def.Swimlane.tasks">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.def.ExceptionHandler.actions">${cache.strategy} </prop> <prop key="org.jbpm.taskmgmt.exe.SwimlaneInstance.pooledActors">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.def.Event.actions">${cache.strategy} </prop> <prop key="org.jbpm.taskmgmt.def.TaskController.variableAccesses">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.def.SuperState.nodes">${cache.strategy} </prop> <prop key="org.jbpm.graph.def.Node.leavingTransitions">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.node.ProcessState.variableAccesses">${cache.strategy} </prop> <prop key="org.jbpm.taskmgmt.exe.TaskInstance.variableInstances">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.def.ProcessDefinition.events">${cache.strategy} </prop> <prop key="org.jbpm.bytes.ByteArray.byteBlocks">$ {cache.strategy}</prop> <prop key="org.jbpm.taskmgmt.def.Task.events">${cache.strategy} </prop> <prop key="org.jbpm.taskmgmt.exe.TaskMgmtInstance.swimlaneInstances">$ {cache.strategy}</prop> <prop key="org.jbpm.context.exe.ContextInstance.tokenVariableMaps">${cache.strategy} </prop> <prop key="org.jbpm.context.exe.TokenVariableMap.variableInstances">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.exe.ProcessInstance.runtimeActions">${cache.strategy} </prop> <prop key="org.jbpm.logging.log.CompositeLog.children">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.def.ProcessDefinition.exceptionHandlers">${cache.strategy} </prop> <!-- <prop key="org.jbpm.graph.action.Script.variableAccesses">$ {cache.strategy}</prop>--> <prop key="org.jbpm.graph.exe.Token.comments">${cache.strategy} </prop> <prop key="org.jbpm.graph.def.Node.events">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.def.ProcessDefinition.definitions">${cache.strategy} </prop> <prop key="org.jbpm.graph.exe.Token.children">$ {cache.strategy}</prop> <prop key="org.jbpm.file.def.FileDefinition.processFiles">${cache.strategy} </prop> <prop key="org.jbpm.taskmgmt.exe.TaskMgmtInstance.taskInstances">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.def.Transition.exceptionHandlers">${cache.strategy} </prop> <prop key="org.jbpm.taskmgmt.def.Task.exceptionHandlers">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.def.ProcessDefinition.nodes">${cache.strategy} </prop> <prop key="org.jbpm.taskmgmt.exe.PooledActor.taskInstances">$ {cache.strategy}</prop> <prop key="org.jbpm.taskmgmt.exe.TaskInstance.comments">${cache.strategy} </prop> <prop key="org.jbpm.graph.def.ProcessDefinition.actions">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.def.Node.arrivingTransitions">${cache.strategy} </prop> <prop key="org.jbpm.graph.def.Node.exceptionHandlers">$ {cache.strategy}</prop> <!--<prop key="org.jbpm.taskmgmt.def.TaskMgmtDefinition.tasks">${cache.strategy} </prop> --> <prop key="org.jbpm.graph.exe.ProcessInstance.instances">$ {cache.strategy}</prop> </props> </property> <property name="entityCacheStrategies" > <props> <prop key="org.jbpm.graph.def.Node">${cache.strategy} </prop> <prop key="org.jbpm.logging.log.ProcessLog">$ {cache.strategy}</prop> <prop key="org.jbpm.context.exe.VariableInstance">${cache.strategy} </prop> <prop key="org.jbpm.instantiation.Delegation">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.def.ProcessDefinition">${cache.strategy} </prop> <prop key="org.jbpm.graph.exe.Token">$ {cache.strategy}</prop> <prop key="org.jbpm.taskmgmt.exe.PooledActor">${cache.strategy} </prop> <prop key="org.jbpm.graph.def.Transition">$ {cache.strategy}</prop> <prop key="org.jbpm.module.exe.ModuleInstance">${cache.strategy} </prop> <prop key="org.jbpm.taskmgmt.exe.TaskInstance">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.exe.RuntimeAction">${cache.strategy} </prop> <prop key="org.jbpm.graph.def.Action">$ {cache.strategy}</prop> <prop key="org.jbpm.module.def.ModuleDefinition">${cache.strategy} </prop> <prop key="org.jbpm.context.exe.TokenVariableMap">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.def.ExceptionHandler">${cache.strategy} </prop> <prop key="org.jbpm.job.Job">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.exe.ProcessInstance">${cache.strategy} </prop> <prop key="org.jbpm.taskmgmt.def.Task">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.def.Event">${cache.strategy} </prop> <prop key="org.jbpm.bytes.ByteArray">$ {cache.strategy}</prop> <prop key="org.jbpm.context.def.VariableAccess">${cache.strategy} </prop> <prop key="org.jbpm.taskmgmt.def.TaskController">$ {cache.strategy}</prop> <prop key="org.jbpm.graph.exe.Comment">${cache.strategy} </prop> <prop key="org.jbpm.taskmgmt.def.Swimlane">$ {cache.strategy}</prop> <prop key="org.jbpm.taskmgmt.exe.SwimlaneInstance">${cache.strategy} </prop> </props> </property>
          Hide
          Daniel Gradecak added a comment -

          Forgot to tell that what I noticed on 600 workflows is this (on 3.4a, same results on 3.3g and 3.2):

          1st : 8156 ms
          2nd : 1844 ms
          3rd :1813 ms
          4th: 1750 ms

          those calls are done in the same method and whenever that method is re-executed we have the same results so the 1st. time we have the slowest one...

          the test is this:
          List<WorkflowTask> assignedTasks = workflowService.getAssignedTasks("admin",
          WorkflowTaskState.IN_PROGRESS);

          for (WorkflowTask workflowTask : assignedTasks)

          { List<NodeRef> packageContents = workflowService.getPackageContents(workflowTask.id); }

          also ... of course the pkg access is making it this slow, but where is caching?

          Show
          Daniel Gradecak added a comment - Forgot to tell that what I noticed on 600 workflows is this (on 3.4a, same results on 3.3g and 3.2): 1st : 8156 ms 2nd : 1844 ms 3rd :1813 ms 4th: 1750 ms those calls are done in the same method and whenever that method is re-executed we have the same results so the 1st. time we have the slowest one... the test is this: List<WorkflowTask> assignedTasks = workflowService.getAssignedTasks("admin", WorkflowTaskState.IN_PROGRESS); for (WorkflowTask workflowTask : assignedTasks) { List<NodeRef> packageContents = workflowService.getPackageContents(workflowTask.id); } also ... of course the pkg access is making it this slow, but where is caching?
          Hide
          Will Taylor added a comment -

          This is one of a collection of Jira issues that have been reported against Community Edition after 3.1 but before 4.2 that either lack enough information to be recreated or have not been seen by the QA team or any customers using Enterprise Edition.

          We want to make sure that valid issues that still exist in 4.2.c Community Edition have a better chance of getting addressed. To do that, we need to reduce the queue of issues that may no longer be valid.

          Please comment on the issue with your testing results. It might be something like, "Yes, this is still a bug on 4.2.c and here are the steps to reproduce it" or it might be "Unable to reproduce on 4.2.c" or "Needs more information" etc.

          If possible, we'd like this to happen by December 21. Any issues on this list that can't be re-produced will be closed out on December 28. They can always be re-opened if they crop up again.

          Show
          Will Taylor added a comment - This is one of a collection of Jira issues that have been reported against Community Edition after 3.1 but before 4.2 that either lack enough information to be recreated or have not been seen by the QA team or any customers using Enterprise Edition. We want to make sure that valid issues that still exist in 4.2.c Community Edition have a better chance of getting addressed. To do that, we need to reduce the queue of issues that may no longer be valid. Please comment on the issue with your testing results. It might be something like, "Yes, this is still a bug on 4.2.c and here are the steps to reproduce it" or it might be "Unable to reproduce on 4.2.c" or "Needs more information" etc. If possible, we'd like this to happen by December 21. Any issues on this list that can't be re-produced will be closed out on December 28. They can always be re-opened if they crop up again.
          Hide
          Will Taylor added a comment -

          No response was received before the cut-off.
          Please raise a new issue, linked to this issue, if it is found to recur.

          Show
          Will Taylor added a comment - No response was received before the cut-off. Please raise a new issue, linked to this issue, if it is found to recur.

            People

            • Assignee:
              Closed Issues
              Reporter:
              Ken Geis
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: