2 Replies Latest reply on Nov 6, 2013 1:28 PM by mashama

    In non-volatile repository configurations does ModeShape load the entire repository into memory on Session.getRootNode()?

    mashama

      I have a non-volatile repository configuration organizing a lot of ~1 MB files.  I would like to know if all of the files for a given workspace will be loaded into memory when I call Session.getRootNode()?  If not then what is the heuristic behind loading content in to memory?  If so I will likely need to architect my workspaces such that MS only loads subsets of files that are most likely to be accessed together.  I would like to not be greedy in my consumption of memory resources.

       

      I have always assumed the answer to this question is yes.

        • 1. Re: In non-volatile repository configurations does ModeShape load the entire repository into memory on Session.getRootNode()?
          rhauch

          By "non-volatile", I presume that you mean the repository is configured to persist to the file system, database, or some other storage.

           

          If that's the case, then the repository will definitely NOT load the entire content into memory, ever. Instead, individual nodes are loaded into memory from persistent storage as needed, and they are cached within a workspace cache that uses the LIRS algorithm (an improvement over LRU). Changes to nodes are of course managed within your session (only the delta is stored in memory in your session), and persisted upon save (or upon transaction commit if you're using user transactions). Note that you do have control over the workspace cache configuration.

           

          Binary values are NEVER all loaded into memory, either. In fact, most of the binary storage options will only buffer some of a single binary value only as your application stream through the binary value's content.

           

          There are ways in which ModeShape configured to store everything into memory. The first is a local "volatile" repository that never persists anything; as soon as the repository is shut down, all content is lost. The other is if ModeShape is clustered in distributed mode with no cache store, and in this case all content is actually stored multiple times in memory across the cluster. (This topology is actually not recommended at this time.)

          • 2. Re: In non-volatile repository configurations does ModeShape load the entire repository into memory on Session.getRootNode()?
            mashama

            Excellent.