8 Replies Latest reply on Dec 13, 2005 9:00 PM by Elmo

    jBPM performance

    Ashwini Kumar Newbie

      I am having a lot of performance related problems with my jBPM deployment. Currently, I have not integrated it with any application server. Inserting 500 tasks requires close to 30 seconds even when I am using the PreparedStatement batch insert via Hibernate. Getting a list of tasks is even worse. The "taskMgmtSession.findPooledTaskInstances" method returns in about two minutes when the user has 500 tasks assigned to him/her.

      This surely seems like a configuration issue. I tried to configure the default c3p0 cache but got a lot of exceptions when trying to flush my session after saving 500 tasks. Following is my configuration for the cache.


      Is there a more robust connection pool that we can use? Does anyone have any clues about trying to boost the badly needed performance?


        • 1. Re: jBPM performance
          Ronald van Kuijk Master

          how do you insert the tasks? do you have sample code? Or better, write a unit test for it. Then we can check how it runs here.

          • 2. Re: jBPM performance
            Ashwini Kumar Newbie


            I did some timing and narrowed down the problem to the worst offender.

             private static Map getMap (TaskInstance tInstance)
             List formParameters = tInstance.getTaskFormParameters();
             Object object = null;
             Map taskMap = new HashMap ();
             taskMap.put("taskId", new Long(tInstance.getId()));
             Iterator iter = formParameters.iterator();
             while (iter.hasNext()) {
             TaskFormParameter tfp = (TaskFormParameter) iter.next();
             String label = tfp.getLabel();
             object = tfp.getValue();
             taskMap.put(label, object);
             return taskMap;

            I have a list of TaskInstances. (2000 in number). When I iterate over this list to get a Map of all the formParameters using the above method, it seems to take 8 minutes.

            One run of the above method is approximately 200 milliseconds. For 2000 TaskInstances, it is 400000 milliseconds.

            This is an unacceptable performance. Maybe it is lazy loading the formparameters. Is there any way to improve the performance of the above?


            • 3. Re: jBPM performance
              Ashwini Kumar Newbie

              I have discovered that this particular line

              List formParameters = tInstance.getTaskFormParameters();

              is particularly time consuming. Almost 200 milliseconds per iteration. Any ideas why this may be the case?

              We have to assign variables (Form parameter) to tasks. After all it is only these variables that qualify the task. So, if we cannot do without these variables, how do we increase performance?


              • 4. Re: jBPM performance
                Ronald van Kuijk Master

                hmm... this is one for Tom, I'll notify him of this issue.

                • 5. Re: jBPM performance
                  Tom Baeyens Master

                  i would expect the getMap only to be called after 1 specific task instance is selected. and not e.g. to show the task list.

                  do you see this behaviour in the jbpm webapp or is it your own code ?

                  Is there any way to improve the performance of the above?

                  probably lots of options. just a matter of exploring them.

                  regards, tom.

                  • 6. Re: jBPM performance
                    Ronald van Kuijk Master

                    The current jBPM webapp does not iterate over taskinstances. So it probably is a home-grown webapp. I can see caes however where info from a task needs to be displayed in the task-list. If a paged task-list is used and the data is fetched lazy, it should 'only' take 10*200ms = 2 seconds, which is imo still a lot. Certainly if just one element needs to be displayed in the tasklist.

                    I think I can easily add the functionality to just load one taskFormParameter from the database.

                    • 7. Re: jBPM performance
                      Ashwini Kumar Newbie

                      I have 4 Integers associated with a taskInstance that are persisted in jbpm database.

                      Strangely, retrieval of only one Integer takes a very long time. All others are retrieved very quickly.

                      Object value = contextInstance.getVariable(variableAccess.getVariableName(), token);

                      the above line in TaskController is the one that takes a long time (150 milli seconds). As I understood, this line does not interface with the database further down the hierarchy. So what is causing the problem (time delay) with this one particular form variable?


                      • 8. Re: jBPM performance
                        Elmo Novice


                        If all else fails, why not just use the traditional approach and query the database directly and use paging? Maybe you also need to check if the tables are properly indexed.