Bug 743171

Summary: Optimized 'ProcessInstancesWaitingForEvent' query for improved performance
Product: [JBoss] JBoss Enterprise BRMS Platform 5 Reporter: Jeffrey Bride <jbride2001>
Component: jBPM 5Assignee: Kris Verlaenen <kverlaen>
Status: CLOSED CURRENTRELEASE QA Contact: Lukáš Petrovický <lpetrovi>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: BRMS 5.3.0.GACC: brms-jira
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-11-08 14:26:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jeffrey Bride 2011-10-04 03:35:30 UTC
performance tests on processes that are defined with sub-processes reveals that the existing 'ProcessInstancesWaitingForEvent' named query quickly becomes a performance bottleneck.

Specifically, performance tests have been conducted on jbpm5 (git hub commit #:  129b5b2d2f1e8173f16be6a8df8a2d06daf4b22d ) running on RHEL 5.5 with two CPUs with latest PostgreSQL available for that OS (PostgreSQL 8.4).  Performance tests revealed that postgresql processes quickly pegged CPU utilization at 90-95%.

As an alternative, the following modification to the 'ProcessInstancesWaitingForEvent' named query completely stabilized our test results by bringing PostgreSQL CPU utilization back down to 15-25% :



<named-query name="ProcessInstancesWaitingForEvent">
        <query>
  select
        processInstanceInfo.processInstanceId
  from
        ProcessInstanceInfo processInstanceInfo join    processInstanceInfo.eventTypes eventTypes
where
        eventTypes=:type
        </query>
</named-query>

Comment 1 Jeffrey Bride 2011-11-08 14:26:04 UTC
Fixed on Oct 6 in jbpm-persistence-jpa/src/main/resources/META-INF/orm.xml