AnsweredAssumed Answered

Activiti Performance

Question asked by bcymet on Jun 10, 2014
Latest reply on Jun 27, 2014 by jbarrez
Hi,

Setup Details:

SLES 11 SP3
Activiti 5.15.1
Fronted with Apache for SSL connected with mod_jk to tomcat
Activiti process are triggered through the rest interface from a php page
Postgres DB accessed with JDBC

I have a linear workflow (no parallel activities). The workflow has one user task and then a number of service tasks that access some web services using HTTP Connections in java. These services require client side SSL verification so a local keystore is used that is on the activiti server.  When I trigger the process when the engine is idle  it takes about 1.3 - 1.8 second to complete. When I start to do some performance testing using grinder things start to really slow down. Sometimes taking 20+ seconds to complete the same process.

Is there a limit to the number concurrent processes that activiti can handle?
Is there a way to configure the activiti engine to use more threads?
I see a lot of references to configuring the number of threads in the thread pool. I have seen a lot of examples of doing this when creating the engine in java but I can't figure out how to do it for the rest interface through a config file?

A couple of other things to note:

1) The activiti engine and the postgres db are running on the same server but it has plenty of resources
2) I am running each process as the same activiti user. I am not sure if that matters.

Any help would be great.

If you need any more information let me know.

Here is my BPMN file for reference. The "Call Activity" in the workflow will never be triggered in this current testing setup.


<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="websalesWorkflow" name="Websales Workflow" isExecutable="true">
    <startEvent id="startevent1" name="Start" activiti:initiator="Initiator"></startEvent>
    <userTask id="submitPlayData" name="Submit Play Data" activiti:assignee="${Initiator}">
      <extensionElements>
        <activiti:formProperty id="userName" name="User Name" type="string" variable="username" required="true"></activiti:formProperty>
        <activiti:formProperty id="playData" name="Play Data" type="string" variable="playdata" required="true"></activiti:formProperty>
        <activiti:formProperty id="calculatedPurchaseValue" name="Calculated Purchase Value" type="string" variable="calcval" required="true"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <serviceTask id="checkDailyLimit" name="Check Daily Limit" activiti:class="com.cbnco.activiti.websales.WebsalesCheckDailyLimit"></serviceTask>
    <exclusiveGateway id="dailyLimitCheckResult" name="Daily Limit Check Result"></exclusiveGateway>
    <endEvent id="limitCheckFailedEndEvent" name="Daily Limit Check Failed End Event"></endEvent>
    <serviceTask id="checkWalletBalence" name="Check Wallet Balence" activiti:class="com.cbnco.activiti.websales.WebsalesCheckEWalletBalance"></serviceTask>
    <callActivity id="callTopupProcess" name="Call Top Up Process" calledElement="WalletTopupProcess">
      <extensionElements>
        <activiti:in source="Initiator" target="Initiator"></activiti:in>
        <activiti:in source="username" target="username"></activiti:in>
        <activiti:out source="topUpSuccessful" target="topUpSuccessful"></activiti:out>
        <activiti:out source="topUpMessage" target="topUpMessage"></activiti:out>
        <activiti:out source="topUpRuns" target="topUpRuns"></activiti:out>
      </extensionElements>
    </callActivity>
    <exclusiveGateway id="topupResult" name="Top Up Result"></exclusiveGateway>
    <serviceTask id="purchaseTicket" name="Purchase Ticket" activiti:class="com.cbnco.activiti.websales.WebsalesPurchase"></serviceTask>
    <exclusiveGateway id="purchaseTicketResult" name="Purchase Ticket Result"></exclusiveGateway>
    <endEvent id="purchaseSuccessEndEvent" name="Purchase Success End Event"></endEvent>
    <sequenceFlow id="startFlow" name="Start" sourceRef="startevent1" targetRef="submitPlayData"></sequenceFlow>
    <sequenceFlow id="checkLimitFlow" name="Check Limit" sourceRef="submitPlayData" targetRef="checkDailyLimit"></sequenceFlow>
    <sequenceFlow id="checkLimitResultFlow" name="Check Limit Result" sourceRef="checkDailyLimit" targetRef="dailyLimitCheckResult"></sequenceFlow>
    <sequenceFlow id="checkLimitFailedFlow" name="Limit Exceeded" sourceRef="dailyLimitCheckResult" targetRef="limitCheckFailedEndEvent">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${limitCheckResult == false}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="limitOkFlow" name="Limit Ok" sourceRef="dailyLimitCheckResult" targetRef="checkWalletBalence">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${limitCheckResult == true}]]></conditionExpression>
    </sequenceFlow>
    <exclusiveGateway id="checkWalletResult" name="Check Wallet Result"></exclusiveGateway>
    <sequenceFlow id="needTopUpFlow" name="Need Top Up" sourceRef="checkWalletResult" targetRef="callTopupProcess">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${eWalletCheckResult == false}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="walletOkFlow" name="Wallet Ok" sourceRef="checkWalletResult" targetRef="purchaseTicket">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${eWalletCheckResult == true}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="checkWalletFlow" name="Check Wallet" sourceRef="checkWalletBalence" targetRef="checkWalletResult"></sequenceFlow>
    <sequenceFlow id="topUpResultFlow" sourceRef="callTopupProcess" targetRef="topupResult"></sequenceFlow>
    <sequenceFlow id="purchaseTicketFlow" sourceRef="topupResult" targetRef="purchaseTicket">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${topUpSuccessful == true}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="topUpBadResultFlow" sourceRef="topupResult" targetRef="callTopupProcess">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${topUpSuccessful == false}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="purchaseTicketResultFlow" sourceRef="purchaseTicket" targetRef="purchaseTicketResult"></sequenceFlow>
    <sequenceFlow id="purchaseSuccessful" name="Purchase Successful" sourceRef="purchaseTicketResult" targetRef="purchaseSuccessEndEvent">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${purchaseSuccessful == true}]]></conditionExpression>
    </sequenceFlow>
    <boundaryEvent id="topUpProcessTimer" name="Top Up Process Timer" attachedToRef="callTopupProcess" cancelActivity="true">
      <timerEventDefinition>
        <timeDuration>PT5M</timeDuration>
      </timerEventDefinition>
    </boundaryEvent>
    <endEvent id="TopUpTimeOutEndEvent" name="Top Up Time Out End Event"></endEvent>
    <sequenceFlow id="topUpTimeoutFlow" name="Top Up Timed Out" sourceRef="topUpProcessTimer" targetRef="TopUpTimeOutEndEvent"></sequenceFlow>
    <sequenceFlow id="tooManyTopUpsFlow" sourceRef="topupResult" targetRef="TopUpTimeOutEndEvent">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${topUpRuns == "10"}]]></conditionExpression>
    </sequenceFlow>
    <endEvent id="purchaseErrorEndEvent" name="Purchase Error End Event"></endEvent>
    <sequenceFlow id="purchaseFailed" name="Purchase Failed" sourceRef="purchaseTicketResult" targetRef="purchaseErrorEndEvent"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_websalesWorkflow">
    <bpmndi:BPMNPlane bpmnElement="websalesWorkflow" id="BPMNPlane_websalesWorkflow">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="40.0" y="290.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="submitPlayData" id="BPMNShape_submitPlayData">
        <omgdc:Bounds height="105.0" width="105.0" x="158.0" y="254.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="checkDailyLimit" id="BPMNShape_checkDailyLimit">
        <omgdc:Bounds height="109.0" width="105.0" x="342.0" y="254.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="dailyLimitCheckResult" id="BPMNShape_dailyLimitCheckResult">
        <omgdc:Bounds height="40.0" width="40.0" x="590.0" y="287.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="limitCheckFailedEndEvent" id="BPMNShape_limitCheckFailedEndEvent">
        <omgdc:Bounds height="35.0" width="35.0" x="593.0" y="410.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="checkWalletBalence" id="BPMNShape_checkWalletBalence">
        <omgdc:Bounds height="111.0" width="105.0" x="558.0" y="100.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="callTopupProcess" id="BPMNShape_callTopupProcess">
        <omgdc:Bounds height="141.0" width="105.0" x="820.0" y="-90.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="topUpProcessTimer" id="BPMNShape_topUpProcessTimer">
        <omgdc:Bounds height="30.0" width="30.0" x="880.0" y="-70.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="topupResult" id="BPMNShape_topupResult">
        <omgdc:Bounds height="40.0" width="40.0" x="980.0" y="-40.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="purchaseTicket" id="BPMNShape_purchaseTicket">
        <omgdc:Bounds height="89.0" width="105.0" x="948.0" y="152.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="purchaseTicketResult" id="BPMNShape_purchaseTicketResult">
        <omgdc:Bounds height="40.0" width="40.0" x="980.0" y="286.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="purchaseSuccessEndEvent" id="BPMNShape_purchaseSuccessEndEvent">
        <omgdc:Bounds height="35.0" width="35.0" x="983.0" y="409.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="checkWalletResult" id="BPMNShape_checkWalletResult">
        <omgdc:Bounds height="40.0" width="40.0" x="740.0" y="77.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="TopUpTimeOutEndEvent" id="BPMNShape_TopUpTimeOutEndEvent">
        <omgdc:Bounds height="35.0" width="35.0" x="1160.0" y="-73.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="purchaseErrorEndEvent" id="BPMNShape_purchaseErrorEndEvent">
        <omgdc:Bounds height="35.0" width="35.0" x="1240.0" y="290.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="startFlow" id="BPMNEdge_startFlow">
        <omgdi:waypoint x="75.0" y="307.0"></omgdi:waypoint>
        <omgdi:waypoint x="158.0" y="306.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12.0" width="23.0" x="85.0" y="307.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="checkLimitFlow" id="BPMNEdge_checkLimitFlow">
        <omgdi:waypoint x="263.0" y="306.0"></omgdi:waypoint>
        <omgdi:waypoint x="342.0" y="308.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12.0" width="57.0" x="273.0" y="306.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="checkLimitResultFlow" id="BPMNEdge_checkLimitResultFlow">
        <omgdi:waypoint x="447.0" y="308.0"></omgdi:waypoint>
        <omgdi:waypoint x="590.0" y="307.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12.0" width="91.0" x="457.0" y="308.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="checkLimitFailedFlow" id="BPMNEdge_checkLimitFailedFlow">
        <omgdi:waypoint x="610.0" y="327.0"></omgdi:waypoint>
        <omgdi:waypoint x="610.0" y="410.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12.0" width="74.0" x="620.0" y="327.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="limitOkFlow" id="BPMNEdge_limitOkFlow">
        <omgdi:waypoint x="610.0" y="287.0"></omgdi:waypoint>
        <omgdi:waypoint x="610.0" y="211.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12.0" width="40.0" x="620.0" y="287.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="needTopUpFlow" id="BPMNEdge_needTopUpFlow">
        <omgdi:waypoint x="760.0" y="77.0"></omgdi:waypoint>
        <omgdi:waypoint x="759.0" y="6.0"></omgdi:waypoint>
        <omgdi:waypoint x="820.0" y="-20.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12.0" width="65.0" x="770.0" y="77.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="walletOkFlow" id="BPMNEdge_walletOkFlow">
        <omgdi:waypoint x="760.0" y="117.0"></omgdi:waypoint>
        <omgdi:waypoint x="760.0" y="179.0"></omgdi:waypoint>
        <omgdi:waypoint x="948.0" y="196.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12.0" width="47.0" x="770.0" y="117.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="checkWalletFlow" id="BPMNEdge_checkWalletFlow">
        <omgdi:waypoint x="663.0" y="155.0"></omgdi:waypoint>
        <omgdi:waypoint x="760.0" y="117.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12.0" width="64.0" x="673.0" y="155.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="topUpResultFlow" id="BPMNEdge_topUpResultFlow">
        <omgdi:waypoint x="925.0" y="-20.0"></omgdi:waypoint>
        <omgdi:waypoint x="980.0" y="-20.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="purchaseTicketFlow" id="BPMNEdge_purchaseTicketFlow">
        <omgdi:waypoint x="1000.0" y="0.0"></omgdi:waypoint>
        <omgdi:waypoint x="1000.0" y="152.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="topUpBadResultFlow" id="BPMNEdge_topUpBadResultFlow">
        <omgdi:waypoint x="980.0" y="-20.0"></omgdi:waypoint>
        <omgdi:waypoint x="925.0" y="-20.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="purchaseTicketResultFlow" id="BPMNEdge_purchaseTicketResultFlow">
        <omgdi:waypoint x="1000.0" y="241.0"></omgdi:waypoint>
        <omgdi:waypoint x="1000.0" y="286.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="purchaseSuccessful" id="BPMNEdge_purchaseSuccessful">
        <omgdi:waypoint x="1000.0" y="326.0"></omgdi:waypoint>
        <omgdi:waypoint x="1000.0" y="409.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="36.0" width="100.0" x="1010.0" y="326.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="topUpTimeoutFlow" id="BPMNEdge_topUpTimeoutFlow">
        <omgdi:waypoint x="910.0" y="-55.0"></omgdi:waypoint>
        <omgdi:waypoint x="1160.0" y="-56.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12.0" width="90.0" x="1085.0" y="-220.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="tooManyTopUpsFlow" id="BPMNEdge_tooManyTopUpsFlow">
        <omgdi:waypoint x="1000.0" y="-40.0"></omgdi:waypoint>
        <omgdi:waypoint x="1000.0" y="-56.0"></omgdi:waypoint>
        <omgdi:waypoint x="1160.0" y="-56.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="purchaseFailed" id="BPMNEdge_purchaseFailed">
        <omgdi:waypoint x="1020.0" y="306.0"></omgdi:waypoint>
        <omgdi:waypoint x="1240.0" y="307.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="12.0" width="79.0" x="1030.0" y="306.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>


Thanks,

Bram

1) Activiti and the P

Outcomes