5 Replies Latest reply on Dec 17, 2014 1:29 AM by Maciej Swiderski

    jbpm6 performance issue: completing a task cost a lot of time

    Steven Hu Newbie

      I am suffering a severe performance issue when using remote rest API to interact with jbpm6.x. The database is created automaticall by kie-wb by the setting "hibernate.hbm2ddl.auto=update".I stimulated around 20 users. The process had 5 user tasks. I used the per process instance strategy. It worked well in first half an hour. But it slowed down later and often couldn't finish the completion of task. I observed the getting a list of tasks of size 20 per page costed about 15 seconds. The 15 seconds is from creating runtime engine, calling REST api to getting the returned data.  Of it the data layer costed 7s to finish the query (between sending the serialized request and receiving serialized response in method AbstractRemoteCommandObject.executeRestCommand). But after I restarted the server, it worked well at the beginning, and slowed down in hours. Does anyone have any ideas?

        • 1. Re: jbpm6 performance issue: completing a task cost a lot of time
          Maciej Swiderski Master

          depending what version and what container you use there was memory leak that was actually causing exact same behavior. It was for 6.0 and running on tomcat so if any of these is true for you you might be affected by that. Reason of the memory leak was to frequent (and unnecessary) creation of entity manager factory as it was assuming entity manager factory is delivered by container while on tomcat it is not.

           

          HTH

          1 of 1 people found this helpful
          • 2. Re: jbpm6 performance issue: completing a task cost a lot of time
            Steven Hu Newbie

            Maciej, thanks.

             

            I did more tests in recent days. Virtually I used the Websphere application server. I did not observe the obvious memory leak. I tested the Evaluation sample using two different accessing ways: one used remote API, and another used common java api(directly calling jbpm api, just like embedded mode). Under the same workload, the common java api was much faster than remote API. Even when I just used one thread to circularly execute the complete evalation process (start process, complete tasks) 200 times, I observed each later operation costed at least over 10s, and the test lasted over 3 hours. So I suspect the jaxb conversion and REST communication over HTTP caused the issue.

             

            BTW I wonder if there is EJB api for the remote interaction. is it on your roadmap?

            • 3. Re: jbpm6 performance issue: completing a task cost a lot of time
              Maciej Swiderski Master

              in 6.2 there will be ejb services available so you could make use of those. Some details can be found here. Though it was not tested on WebSphere but in general there should be no known issues with server side code but there is no dedicated ejb client available. Only JBoss based is currently available so contributions for client side code for ejb client on WebSphere is more than welcome.

               

              HTH

              1 of 1 people found this helpful
              • 4. Re: jbpm6 performance issue: completing a task cost a lot of time
                Steven Hu Newbie

                Thank you for your response.

                I followed your post and give the ejb services a try on WebSphere 8.5. But I faced the following error when starting the kie-wb which was packed in an ear named WFE(workflow engine, only has one module). Kindly note I have put the ejb-related service jars in kie-wb war. It seemed like the Websphere does not allow to inject UserTransaction for ejb CMP.

                 

                Caused by: com.ibm.ejs.container.ContainerException: Failed to start the TransactionalCommandServiceEJBImpl component in the kie-wb.war module of the server1_WFE application. : An operation in the enterprise bean constructor failed. It is recommended that component initialization logic be placed in a PostConstruct method instead of the bean class no-arg constructor.; nested exception is:

                  java.lang.IllegalStateException: Unable to find transaction: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object.

                  at com.ibm.ws.ejbcontainer.runtime.SharedEJBRuntimeImpl.startBean(SharedEJBRuntimeImpl.java:609)

                  at com.ibm.ws.runtime.component.WASEJBRuntimeImpl.startBean(WASEJBRuntimeImpl.java:583)

                  at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime.fireMetaDataCreatedAndStartBean(AbstractEJBRuntime.java:1716)

                  at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime.initializeDeferredEJBImpl(AbstractEJBRuntime.java:1607)

                  at com.ibm.ws.ejbcontainer.runtime.SharedEJBRuntimeImpl.initializeDeferredEJBImpl(SharedEJBRuntimeImpl.java:545)

                  at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime$1$1.run(AbstractEJBRuntime.java:1501)

                  at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime$1$1.run(AbstractEJBRuntime.java:1495)

                  at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5474)

                  at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5600)

                  at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)

                  at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime$1.run(AbstractEJBRuntime.java:1494)

                  ... 37 more

                Caused by: java.lang.IllegalStateException: Unable to find transaction: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object.

                  at org.drools.persistence.jta.JtaTransactionManager.findUserTransaction(JtaTransactionManager.java:139)

                  at org.drools.persistence.jta.JtaTransactionManager.<init>(JtaTransactionManager.java:79)

                  at org.jbpm.shared.services.impl.TransactionalCommandService.<init>(TransactionalCommandService.java:23)

                  at org.jbpm.services.ejb.impl.tx.TransactionalCommandServiceEJBImpl.<init>(TransactionalCommandServiceEJBImpl.java:37)

                  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)

                  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)

                  at java.lang.reflect.Constructor.newInstance(Constructor.java:527)

                  at com.ibm.ws.ejbcontainer.runtime.SharedEJBRuntimeImpl.startBean(SharedEJBRuntimeImpl.java:577)

                  ... 47 more

                Caused by: com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is com.ibm.wsspi.injectionengine.InjectionException: UserTransaction may only be looked up by or injected into an EJB if that EJB is configured to use bean managed transactions.  EJB server1_WFE#kie-wb.war#TransactionalCommandServiceEJBImpl is configured for container managed transactions.]

                  at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:1103)

                  at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:181)

                  at com.ibm.ws.naming.java.javaURLContextRoot.processBoundObjectForLookup(javaURLContextRoot.java:850)

                  at com.ibm.ws.naming.urlbase.UrlContextImpl.lookupExt(UrlContextImpl.java:1454)

                  at com.ibm.ws.naming.java.javaURLContextImpl.lookupExt(javaURLContextImpl.java:477)

                  at com.ibm.ws.naming.java.javaURLContextRoot.lookupExt(javaURLContextRoot.java:485)

                  at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:370)

                  at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)

                  at javax.naming.InitialContext.lookup(InitialContext.java:436)

                  at org.drools.persistence.jta.JtaTransactionManager.findUserTransaction(JtaTransactionManager.java:131)

                  ... 55 more

                Caused by: com.ibm.wsspi.injectionengine.InjectionException: UserTransaction may only be looked up by or injected into an EJB if that EJB is configured to use bean managed transactions.  EJB server1_WFE#kie-wb.war#TransactionalCommandServiceEJBImpl is configured for container managed transactions.

                  at com.ibm.ws.ejbcontainer.injection.factory.HybridUserTransactionObjectFactory.getObjectInstance(HybridUserTransactionObjectFactory.java:96)

                  at org.apache.aries.jndi.ObjectFactoryHelper.getObjectInstanceUsingObjectFactoryBuilders(ObjectFactoryHelper.java:349)

                  at org.apache.aries.jndi.ObjectFactoryHelper.getObjectInstance(ObjectFactoryHelper.java:89)

                  at org.apache.aries.jndi.OSGiObjectFactoryBuilder.getObjectInstance(OSGiObjectFactoryBuilder.java:57)

                  at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:349)

                  at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:993)

                  ... 64 more

                 

                 

                so I changed the TransactionalCommandServiceEJBImpl no-arg constructor 

                public TransactionalCommandServiceEJBImpl() {

                  super();//don't pass arg to prohibit super class to call findUserTransaction

                  // entity manager will be set by setter method

                  }

                and add a no-arg constructor to its parent class, TransactionalCommandService.java. Now the application can start. but NPE is throwed because there is not txm. Any suggestions?

                • 5. Re: jbpm6 performance issue: completing a task cost a lot of time
                  Maciej Swiderski Master

                  ejb services are not meant to be included in kie-wb, kie-wb is cdi based application and thus relies on cdi services of jbpm. ejb can be deployed next to kie-wb (might be on different server as well) and be configured towards the same data base. Once you have that both will have same deployments and access to same data (process instances and tasks). Note that kie-wb must be 6.2 as well.

                   

                  HTH