3 Replies Latest reply on Jul 1, 2010 5:50 AM by Jaber C. Mourad

    jBPM and caching

    Eivind Barstad Waaler Newbie

      Does anyone have any experience enabling Hibernate second-level caching with jBPM? Things like User, Deployment and more are practically never changed in our application, and could easily be cached to reduce the amount of database queries.


      I can get it to work by writing my own custom criteria searches, adding setCacheable(true), but nothing else seems to have any effect. Re-implementing the whole API just to add that one line to all criterias does not seem like a good idea.


      Does anyone have any hints or tips regarding this? Right now our application drowns in database requests with a few hundred active process-instances, and we need it to scale up to at least 10 000.


      Documentation suggests that the Deployment objects are cached, but as far as I can tell that is not happening in our application.


      We are using Spring to set up the SessionFactory. Could this be the problem?

        • 1. Re: jBPM and caching
          Jaber C. Mourad Novice



          Have you tried to activate EHCache for hibernate ?


          I think it may help you even if it is sub-optimised with a very general configuration...



          • 2. Re: jBPM and caching
            Eivind Barstad Waaler Newbie

            Thanks for the reply. I have tried, but it does not seem to have much effect.


            Looks like many of the API-methods are implemented using hql-queries or criteria searches, and none of them have enabled caching. I have enabled class and collection caching, but it does not have much effect when most of the logic runs like queries that are not being cached..


            As an example this "regular" way of getting a user is not cached:


            org.jbpm.api.identity.User user = identityService.findUserById(userName);


            In order to get caching working here we need to reimplement the criteria search used:


            org.jbpm.api.identity.User user = (org.jbpm.api.identity.User) session
                        .add(Restrictions.eq("id", userName))


            Not a big deal for such a simple method, but more of a concern seeing that it is the same for all queries in the system.

            • 3. Re: jBPM and caching
              Jaber C. Mourad Novice



              It's a very good idea, I think you could open a JIRA request for that