2 Replies Latest reply on Aug 29, 2011 11:31 AM by sjahan

    Modeshape performance on browsing

    sjahan Newbie

      Hi everyone,


      Here is a small question about Modeshape's performance.

      My team leader would like to improve the speed of our methods that get back (only reading) data from JCR. The basic operation is to get a part of the JCR tree with a given depth.


      First here is our score: 8.2 seconds to get 1370 nodes containing more or less content on properties, from the root with a depth of 10 levels.

      The amount of data loaded doesn't exceed 200KB.

      Here are the specs of my dev workstation (on which i runned my test) if it could give some relevant figures:


      Software figures:

      JBoss 5.1 AS (default configuration)

      JDK 1.6.0_23


      Hardware figures:

      Intel Core i5 2x 2.67GHz

      4Go RAM

      The whole thing running on Windows 7 Pro 64Bits.


      I don't know if this score is likely to be expected on such a computer, i have no idea at all right now, except that it looks quite long for only 200KB max.


      The methods that reach JCR content via Modeshape were done before i came in the project team, and maybe (certainly) we could improve the way we reach data though Modeshape.

      I just browse a little bit the JCR 2.0 Specs and the Modeshape guide, but didn't really find something that points me out the best way to get a part of the JCR tree, so here is my question.


      How should we proceed to get a part of the tree? (We want all the tree structured in one browsable object, until now, we're using an Element from Jdom to store our graph.)


      Basically, here is how it's performed:

      (Element class being from org.jdom, Node class being from javax.jcr)


      public Element get(Node n){

           Element e = node2Element(n);

           for(Node c : n.getNodes()){



           return e;



      So you can see that we're browsing the tree, branch by branch, deeper and deeper. Is that the fastest/proper way to go?


      If by any chance, you've any idea on that matter!


      Thank you very much by advance,



        • 1. Re: Modeshape performance on browsing
          Randall Hauch Master

          Unfortunately, I don't believe there is a way to use the JCR API to efficiently load an entire subtree (or a subtree of some depth). ModeShape's internal graph API does have support for something like this, and we use that internally in some functionality. But we're pretty strong advocates of using the JCR API whenever possible, so we haven't expose that functionality anywhere. I think it'd be possible to do, but maybe there are a few things you could try first.


          Have you tried playing with the "readDepth" repository option? It may not help in your case, and even if it does in this particular case it may make other operations (that don't require reading subtrees) less efficient.


          Secondly, have you tried some of the suggestions mentioned in How To Tune ModeShape for Better Performance and How To Select The Right Connectors?


          BTW, performance is largely dependent upon the connector(s) you're using. For example, the in-memory, Infinispan, and disk connectors are by far the fastest connectors, largely because of the way they work. Meanwhile, the JPA connector is very much dependent upon your DBMS and network (assuming the DB is not local).

          1 of 1 people found this helpful
          • 2. Re: Modeshape performance on browsing
            sjahan Newbie

            Thank you very much Randall,


            I clearly understand the need to keep with JCR API as much as possible, this is also the way we intend to develop our solution.

            I did not know about the readDepth option, and i will check this one and the other likely to help us!

            I will carefully read both documents you pointed out, thank you very much, it will be a great help.


            About the connectors, we currently use a JPA and a SVN one, both in the same repository under a federator connector.

            The network is quite good i think, not much lag, so we will see how we can improve it.


            Thank you very much for your quick answer!

            Have a very good day,