1 2 Previous Next 18 Replies Latest reply on Jan 22, 2008 3:33 PM by manik Go to original post
      • 15. Re: ClusteredCacheLoader + LOCAL CacheMode
        lovelyliatroim

        Yep both sets of code snippets work. No replication being done.

        Super stuff Brian, thanks alot.



        From your description, it sounds like you might want to use LOCAL cache mode and a TCPCacheLoader. Have you looked into that?


        I have read about it but the thing that i dont want is that when you add an entry into one of the nodes, it will replicate the entry straight away into the cache loader(I assume,i havent played with it yet,maybe you can turn this off). I only want to replicate data on demand, i.e if someone asks for data on a node and it aint there, ask the others in the cluster first if they have,if not then got to source. if i add an entry in a node i dont want to push it somewhere else, it just sits on that node until someone else asks for it.


        • 16. Re: ClusteredCacheLoader + LOCAL CacheMode
          nnnnn

           

          "lovelyliatroim" wrote:


          From your description, it sounds like you might want to use LOCAL cache mode and a TCPCacheLoader. Have you looked into that?


          I have read about it but the thing that i dont want is that when you add an entry into one of the nodes, it will replicate the entry straight away into the cache loader(I assume,i havent played with it yet,maybe you can turn this off). I only want to replicate data on demand, i.e if someone asks for data on a node and it aint there, ask the others in the cluster first if they have,if not then got to source. if i add an entry in a node i dont want to push it somewhere else, it just sits on that node until someone else asks for it.


          I believe that CacheLoaders can be configured with:
          <!-- determines whether this cache loader ignores writes - defaults to false. -->
          <ignoreModifications>true</ignoreModifications>
          

          in order to have the CacheLoader read-only. I haven't actually tried that behavior, so I can't be sure that I'm interpreting it correctly. Maybe one of the jbosscache guys can configrm.

          • 17. Re: ClusteredCacheLoader + LOCAL CacheMode
            lovelyliatroim

            Ok had a look into

            !-- determines whether this cache loader ignores writes - defaults to false. -->
            <ignoreModifications>true</ignoreModifications>
            
            


            and what it can and cant do.

            Here is the config i used
            <mbean code="org.jboss.cache.loader.tcp.TcpCacheServer" name="jboss.cache:service=TcpCacheServer">
             <depends optional-attribute-name="CacheJmxWrapper"
             proxy-type="attribute">jboss.cache:service=PriceServerCache</depends>
             <attribute name="BindAddress">${jboss.bind.address:localhost}</attribute>
             <attribute name="Port">7500</attribute>
             <attribute name="MBeanServerName"></attribute>
             <!--<attribute name="CacheName">jboss.cache:service=TreeCache</attribute>-->
             </mbean>
            

            Reason for posting that is because twiki needs updating for version 2.0 and this shows how to do it for older versions http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossClusteringPatternFarCache

            Anyways if you configure your very first node at startup to refer to a remote TcpDelegateCacheLoader and the other node where it resides isnt started you get a

            org.jboss.cache.CacheException: Unable to start cache loaders

            exception, which is fair enough because the other node is not started but what i didnt expect to happen is that the cache in first node wont be set up, i would have expected the cache loader to fail gracefully and re-try at a later stage to connect but initialisation of the cache would still happen.

            So i configured the first start up node not to refer to any other node but just be the TcpCacheServer. I started the second node with config like so

             <attribute name="CacheLoaderConfig" replace="false">
             <config>
             <cacheloader>
             <class>org.jboss.cache.loader.TcpDelegatingCacheLoader</class>
             <properties>
             host=localhost
             port=7500
             </properties>
             <!-- determines whether this cache loader ignores writes - defaults to false. -->
             <ignoreModifications>true</ignoreModifications>
             </cacheloader>
            
             </config>
             </attribute>
            

            When i put entries into node2, they are replicated or written into the cache in node1. I played around with setting it to true or false and makes no difference. So I suspect 1 of 3 things,
            1. ignoreModifications doesnt work with TcpDelegate, or
            2. I checked the log file to see if i could see some debug where it would say something like "ignoreModifications set to true" but nothing in the log file. So maybe it wasnt set??
            3. ignoreModifications doesnt work like we thought it would :(


            So those are my findings..........

            cheers,
            LL


            • 18. Re: ClusteredCacheLoader + LOCAL CacheMode
              manik

              Adding some JIRA links to this thread for future ref:

              1. IgnoreModifications was designed for use when you chain cache loaders. See JBCACHE-751 for getting this to work on individual cache loaders.

              2. I've created a feature request for being able to use a ClusteredCacheLoader with CacheMode.LOCAL. JBCACHE-1273

              1 2 Previous Next