2 Replies Latest reply on Mar 30, 2010 4:00 PM by Ronald van Kuijk

    Variables Performance

    Andre Muniz Newbie



      My use case is very simple: I need to load all the pending tasks and show information about them (including variables). But I'm having some performance problems when loading those variables.


      Basically my code is like this:



      // Builds the process engine
      ProcessEngine processEngine = new Configuration().buildProcessEngine();
      // Creates the services
      TaskService taskService = processEngine.getTaskService();
      ExecutionService executionService = processEngine.getExecutionService();
      // Loads all the pending tasks
      List < Task > tasks = taskService.createTaskQuery().list();
      // Loads the variables for each task
      for (Task t : tasks) {
           // Variable names
           Set < String > variableNames = new TreeSet < String >();
           // Loads the variables
           Map < String, Object > variables = executionService.getVariables(t.getExecutionId(), variableNames);
           // Shows variables information



      The "taskService.createTaskQuery().list()" method is very fast, but the processing time to load the variables is very high. I'm running some scalability tests, and I realized that the code I've just mentioned is causing a lot of hard disk access (which is causing the performance problems), so I wonder if there is another way of writing this code.


      My question is:

      Am I going in the right direction or there is another way to implement this use case with better performance?


      PS: I've seen the JIRA request to include searching for process instances by variables (https://jira.jboss.org/jira/browse/JBPM-2505) and there are some comments about variable performance, but I'm not sure that in my use case I should have this kind of problem.



        • 1. Re: Variables Performance
          Andre Muniz Newbie

          Did anybody find ways to improve performance while reading process variables intensely?

          PS: Ronald, this looks like a question for you , any ideas or best practices?



          • 2. Re: Variables Performance
            Ronald van Kuijk Master

            :-) As you might have read, there are other some other things keeping me occupied, so less time in the forums and more selective.


            General info:

            - jBPM 4 *public* api is not finished


            Via deduction:

            - custom usage of the query api works great

            - 'normal' api usage does not perform


            Conclusion: usage is not meant for this usecase.


            So either see what you can do more with the query api, or go a level deeper and create your own command (where you have access to low level jdbc but need to use 'internal' classes)





            1 of 1 people found this helpful