[jboss-user] [JBoss jBPM] - Performance in J2EE << J2SE

Johan.Parent do-not-reply at jboss.com
Wed Jun 4 10:34:45 EDT 2008


Hi all,

I ran into the following unpleasant surprise. I basically wrapped jbpm 3.1.4 up and put it into a session bean (EJB2.x).  As the number of tasks grew we discovered that access to process variables became sluggish.

To keep a long story short profiling revealed that the same code when  called from within a J2EE container (weblogic 10) behaves differently than in the "container-less" i.e. J2SE case. More precisely I noticed an increase in the number of invocations on the hibernate enhancer proxies when running inside the container. Next some numbers obtained with JProfiler. 

Calling VariableContainter.getVariablesLocally() 3080 times causes 16170 calls to Token$$EnhancerByCGLIB$$58d3af74.getHibernateLazyInitializer() in the J2SE case. In the J2EE case this last number becomes 129360! And so on for other classes like ProcessInstance. The result is that those 3080 calls take 36.1secs in one case and 9.3secs in the other.

The code is dead simple and boils down to:


  | ...
  | 
  | List tasks = jbpmContext.getTaskMgmtSession().findPooledTaskInstances(USER);
  | 
  | for (Iterator it = tasks.iterator(); it.hasNext();) {
  |    TaskInstance t = (TaskInstance) it.next();
  |     t.getVariables();
  | }
  | 

I'm clearly missing something here. Of course in the J2SE case I use a plain jdbc connection where as in the J2EE case I get the connection from the container.  So I adjusted jbpm.cfg.xml as follows:


  |   <jbpm-context>
  |     <!--<service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />-->
  | 
  |       <service name="persistence">
  |       <factory>
  |         <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
  |           <field name="isCurrentSessionEnabled"><false /></field>
  |           <field name="isTransactionEnabled"><false /></field>
  | 
  |           <!--<field name="isCurrentSessionEnabled"><true /></field>-->
  |         </bean>
  |       </factory>
  |     </service>
  | 
  | ....
  | 

We need the isTransactionEnabled set to false to avoid clashes with the rest of our J2EE app. I tried setting isCurrentSessionEnabled to true with no luck. I'm out of ideas. Any suggestion will be MUCH appreciated!

Best regards,

Johan

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4155703#4155703

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4155703



More information about the jboss-user mailing list