3 Replies Latest reply on Feb 23, 2016 2:23 AM by Horia Chiorean

    Modeshape - Infinispan - Sardine - Wildfly

    muthunagu100 Newbie

      Hello,

       

      I am using Modeshape 4.4.0 in wildfly 9.0.1

      I am using sardine.jar webdav API to store and retrieve PDFs

      Using this setup to store PDF documents - about 15 docs - each 500KB - storing / retrieving one at a time

       

      Infinispan config:

          <local-cache name="artifacts" statistics="false">

                  <transaction

                            mode="NON_XA"

                            locking="PESSIMISTIC"/>

                  <persistence

                            passivation="false">

                  <file-store fetch-state="false"

                            shared="false"

                            preload="false"

                            purge="false"

                            path="/path/artifacts/store"/>

                  </persistence>

           </local-cache>

       

      Sardine Code:

           Sardine sardine = SardineFactory.begin("username", "password");

           List<DavResource> resources = sardine.list("http://myhost.com/modeshape-webdav/artifacts/default");

           for (DavResource res : resources)

           {

                System.out.println(res);

           }

      After a couple of days of usage, my Linux server crashed.

      I am trying to figure-out the reason.

      Could you help me with some info on the following?

       

      1) Infinispan:

      I read that I need to add the following to the infinispan config:

          <locking isolationLevel="READ_COMMITTED"/>

          <eviction strategy="LRU" max-entries="100"/>

      • Would these solve any obvious infinispan issues?
      • If I have to measure the infinispan cache size, how to know the cache space availability, current cache space used and where to specify the cache size.
      • Also, is there a way to determine the Eviction "max-entries"?
      • In my case, would the PDF documents be stored in infinispan or would the meta data alone be stored in infinispan cache?
      • Also, is there anything specific that needs to be done in regards to TransactionManager Or, would wildfly handle it?

      2) Sardine.jar:

      I also read about modeshape that if the session is kept open for a longer period of time, the Modeshape server would crash.

      I am using SardineFactory.begin("username", "password");

      • Would this leave an unclosed session?
      • Is there a way to close this session?

      I couldn't find much information on closing the session from Sardine documentation

        • 1. Re: Modeshape - Infinispan - Sardine - Wildfly
          Horia Chiorean Master

          First and foremost, do you have a stacktrace or any sort of information related to your server crashing ? That would be the starting point in trying to figure out why it crashed. If nothing is obvious at first, I suggest attaching a JVM profiler and looking at the runtime status of the VM.

           

          1) Infinispan:

          I read that I need to add the following to the infinispan config:

              <locking isolationLevel="READ_COMMITTED"/>

              <eviction strategy="LRU" max-entries="100"/>

          • Would these solve any obvious infinispan issues?
          • If I have to measure the infinispan cache size, how to know the cache space availability, current cache space used and where to specify the cache size.
          • Also, is there a way to determine the Eviction "max-entries"?
          • In my case, would the PDF documents be stored in infinispan or would the meta data alone be stored in infinispan cache?
          • Also, is there anything specific that needs to be done in regards to TransactionManager Or, would wildfly handle it?

          what does your repository configuration look like ? If you're storing PDF files, ModeShape will store the actual content in the binary store, not the main repository store.  The main repository store (i.e. Infinispan cache) will only store the JCR related information, while the actual bytes will be stored elsewhere, depending on your repository configuration (https://docs.jboss.org/author/display/MODE40/Binary+values)

           

          The Infinispan eviction settings are required to prevent OOM errors, i.e. to prevent the cache from storing everything in memory (as well as in the cache-store). The actual eviction value is something context-dependent and it's something you have to experiment with. I suggest you read the Infinispan documentation on these topics.

           

          If you're using a WebDAV client (Sardine) you don't need to do any transaction handling or anything else. The ModeShape - Wildfly integration handles that behind the scenes. Your code should only be sending requests to the server.

           

          2) Sardine.jar:

          I also read about modeshape that if the session is kept open for a longer period of time, the Modeshape server would crash.

          I am using SardineFactory.begin("username", "password");

          • Would this leave an unclosed session?
          • Is there a way to close this session?

          I couldn't find much information on closing the session from Sardine documentation

          I don't know the internals of Sardine, that's outside the ModeShape scope.

           

          The ModeShape WebDAV webapp will start & close a session on each client request, so there shouldn't be any unclosed or long-lived sessions (unless there's a bug somewhere). I suggest you enable trace logging for org.modeshape.webdav and check the output for anything unusual.

          • 2. Re: Modeshape - Infinispan - Sardine - Wildfly
            muthunagu100 Newbie

            Hi Horia,

             

            Unfortunately, I was out and we couldn't get the stacktrace. I shall setup the JVM profiler and let you know the updates.

             

            Referring to your link on the Binary files, I find that a binary store needs to be configured, else a transient store will be used. Currently, I haven't configured any binary store. Could this potentially be the reason for the issue? As of now, the PDF files are retrievable after wildfly restarts. Modeshape Backup and restore (nightly backup process) also works.

             

            I've slightly customized and made use of the "artifacts" repository.

            • [Update]: Just now, I added the File Binary Store under ".../wildfly/standalone/data/modeshape/filebinary/artifacts" which is inside the Wildfly/modeshape directory, as our total storage requirements is very less (about 50MBs).

                      <file-binary-storage path="${jboss.server.data.dir}/modeshape/filebinary/artifacts"  mime-type-detection="content"/>

            I tried storing a new document. But, the document didn't get saved under the above mentioned directory for the "file-binary-storage". Due you see any issues in the above configuration?

            • With this "File Binary Store" would the Modeshape Backup & Restore work as the File store resides inside the modeshape/artifacts directory. Or, do I have to manually copy the File binary store to be used in the Secondary repository?
            • Infinispan:

            I added the xml config for "READ_COMMITTED" and got an error saying "infinispan config couldn't be read". Is there any issue with this?

            <locking isolationLevel="READ_COMMITTED"/>
            

             

             

            Here is my current "artifacts" repository configuration. Please refer the attachment for the entire config file.

            Please let me know if you see any potential caveats.

             

            <subsystem xmlns="urn:jboss:domain:modeshape:2.1">
              <webapp name="modeshape-rest.war"/>
              <webapp name="modeshape-webdav.war"/>
              <webapp name="modeshape-cmis.war"/>
              <webapp name="modeshape-explorer.war"/>
              <repository name="sample" anonymous-roles="admin"/>
              <repository name="artifacts" anonymous-roles="admin">
              <file-binary-storage/>
              <workspaces default-workspace="default" allow-workspace-creation="false">
              <workspace name="default">
              <initial-content>initial-content-default.xml</initial-content>
              </workspace>
              <workspace name="other"/>
              <workspace name="extra"/>
              </workspaces>
              <sequencers>
              <sequencer name="delimited-text-sequencer" classname="org.modeshape.sequencer.text.DelimitedTextSequencer"
                module="org.modeshape.sequencer.text" splitPattern=",">
              <path-expression>/files(//*.csv[*])/jcr:content[@jcr:data] => /derived/text/delimited/$1</path-expression>
              </sequencer>
              <sequencer name="fixed-width-text-sequencer"
                classname="org.modeshape.sequencer.text.FixedWidthTextSequencer"
                module="org.modeshape.sequencer.text" commentMarker="#">
              <path-expression>/files(//*.txt[*])/jcr:content[@jcr:data] => /derived/text/fixedWidth/$1</path-expression>
              </sequencer>
              <sequencer name="ddl-sequencer" classname="org.modeshape.sequencer.ddl.DdlSequencer"
                module="org.modeshape.sequencer.ddl">
              <path-expression>/files(//*.ddl[*])/jcr:content[@jcr:data] => /derived/ddl/$1</path-expression>
              </sequencer>
              <sequencer name="java-source-sequencer" classname="org.modeshape.sequencer.javafile.JavaFileSequencer"
                module="org.modeshape.sequencer.java">
              <path-expression>/files//(*.java[*])/jcr:content[@jcr:data] => /derived/java</path-expression>
              </sequencer>
              <sequencer name="java-class-sequencer" classname="org.modeshape.sequencer.classfile.ClassFileSequencer"
                module="org.modeshape.sequencer.java">
              <path-expression>/files//(*.class[*])/jcr:content[@jcr:data] => /derived/class</path-expression>
              </sequencer>
              <sequencer name="cnd-sequencer" classname="cnd" module="org.modeshape">
              <path-expression>default:/files(//*.cnd[*])/jcr:content[@jcr:data] => /derived/cnd/$1</path-expression>
              </sequencer>
              <sequencer name="msoffice-sequencer" classname="msoffice" module="org.modeshape.sequencer.msoffice">
              <path-expression>/files(//*.(xls|ppt|doc)[*])/jcr:content[@jcr:data] => /derived/msoffice/$1</path-expression>
              </sequencer>
              <sequencer name="teiid-model-sequencer" classname="model" module="org.modeshape.sequencer.teiid">
              <path-expression>/files(//*.xmi[*])/jcr:content[@jcr:data] => /derived/teiid/models/$1</path-expression>
              </sequencer>
              <sequencer name="teiid-vdb-sequencer" classname="vdb" module="org.modeshape.sequencer.teiid">
              <path-expression>/files(//*.vdb[*])/jcr:content[@jcr:data] => /derived/teiid/vdbs/$1</path-expression>
              </sequencer>
              <sequencer name="xsd-sequencer" classname="xsd" module="org.modeshape.sequencer.xsd">
              <path-expression>/files(//*).xsd[*]/jcr:content[@jcr:data] => /derived/xsd/$1</path-expression>
              </sequencer>
              <sequencer name="wsdl-sequencer" classname="wsdl" module="org.modeshape.sequencer.wsdl">
              <path-expression>/files(//)*.wsdl[*]/jcr:content[@jcr:data] => /derived/wsdl/$1</path-expression>
              </sequencer>
              <sequencer name="xml-sequencer" classname="xml" module="org.modeshape.sequencer.xml">
              <path-expression>/files(//)*.xml[*]/jcr:content[@jcr:data] => /derived/xml/$1</path-expression>
              </sequencer>
              <sequencer name="zip-sequencer" classname="zip" module="org.modeshape.sequencer.zip">
              <path-expression>/files(//*.zip[*])/jcr:content[@jcr:data] => /derived/zip/$1</path-expression>
              </sequencer>
              <sequencer name="image-sequencer" classname="image" module="org.modeshape.sequencer.image">
              <path-expression>/files(//*.(png|jpg|gif)[*])/jcr:content[@jcr:data] => /derived/image/$1</path-expression>
              </sequencer>
              <sequencer name="mp3-sequencer" classname="mp3" module="org.modeshape.sequencer.mp3">
              <path-expression>/files(//*.mp3[*])/jcr:content[@jcr:data] => /derived/mp3/$1</path-expression>
              </sequencer>
              </sequencers>
              <text-extractors>
              <text-extractor name="tika-extractor" classname="tika" module="org.modeshape.extractor.tika"/>
              </text-extractors>
              </repository>
            </subsystem>
            
            
            • 3. Re: Modeshape - Infinispan - Sardine - Wildfly
              Horia Chiorean Master

              Referring to your link on the Binary files, I find that a binary store needs to be configured, else a transient store will be used. Currently, I haven't configured any binary store. Could this potentially be the reason for the issue? As of now, the PDF files are retrievable after wildfly restarts. Modeshape Backup and restore (nightly backup process) also works.

               

              I've slightly customized and made use of the "artifacts" repository.

              • [Update]: Just now, I added the File Binary Store under ".../wildfly/standalone/data/modeshape/filebinary/artifacts" which is inside the Wildfly/modeshape directory, as our total storage requirements is very less (about 50MBs).

              <file-binary-storage path="${jboss.server.data.dir}/modeshape/filebinary/artifacts"  mime-type-detection="content"/>

              Without a binary store configured, the transient binary store will store data either in java.io.tmpdir or jboss.server.temp.dir (in Wildfly). On each repository startup ModeShape attempts to delete this folder. However, depending on outside "conditions" (e.g. file locks on Windows) it may happen that this folder can't be removed. If that's the case, it should explain why you're able to retrieve binary content after restarting. You can test this by manually removing the content of the temp folder between restarts.

               

              If you've configured a binary store and restarted the server, binary data should be stored in the configured location. Enable trace logging to see if anything weird is going on.

              • With this "File Binary Store" would the Modeshape Backup & Restore work as the File store resides inside the modeshape/artifacts directory. Or, do I have to manually copy the File binary store to be used in the Secondary repository?

              backup and restore works using the repository internal API; it doesn't rely on any configuration parameters. So regardless of your configuration, it should backup and restore both the repository content and binaries

              • Infinispan:

              I added the xml config for "READ_COMMITTED" and got an error saying "infinispan config couldn't be read". Is there any issue with this?

              your syntax is incorrect (check the Infinispan XSDs). The correct syntax is:

               

              <locking isolation="READ_COMMITTED"/>
              
              

               

              Also, make sure you're using the latest ModeShape version which is 4.5.0.Final. Note that none of the above explain in any way why your server crashed.