4 Replies Latest reply on Feb 10, 2005 2:20 PM by a b

    Invalidation / Lazy Replication

    a b Newbie

      Hi,

      We are currently developing a client/server application. The server uses Hibernate for persistence, with TreeCache for the second-level cache. The clients need local data caches, and we were thinking that an easy way of implementing these local client caches might be to replicate the server cache to all the clients.

      However, we are hesitant to go this route due to the amount of data that could be involved. There are two cache features that would make the outlined implementation more palatable:

      - An invalidation model. When a node gets updated on the server, the clients receive notification that the specified node is no longer valid, but do not retrieve the data itself.

      - Lazy replication. When invalidated/uninitialized nodes are accessed on the clients, the data is retrieved transparently from the server cache.

      I have searched the forums and have found a couple of similar questions, some suggesting the use of a custom CacheLoader, or perhaps SharedStoreCacheLoader or DelegatingCacheLoader. However, neither of these can be configured via XML (no empty constructor), and even configuring them via code, it's not clear whether or not you can specify remote CacheLoader's/TreeCache's to delegate to.

      I'd be interested to hear what people think our options might be. Aside from switching to OSCache ;-)

      Regards,

      Daniel Gredler

        • 1. Re: Invalidation / Lazy Replication
          Bela Ban Master

           

          "sdanig" wrote:
          Hi,

          We are currently developing a client/server application. The server uses Hibernate for persistence, with TreeCache for the second-level cache. The clients need local data caches, and we were thinking that an easy way of implementing these local client caches might be to replicate the server cache to all the clients.

          However, we are hesitant to go this route due to the amount of data that could be involved. There are two cache features that would make the outlined implementation more palatable:

          - An invalidation model. When a node gets updated on the server, the clients receive notification that the specified node is no longer valid, but do not retrieve the data itself.


          I have added a JIRA task to provide invalidate() across a cluster: http://jira.jboss.com/jira/browse/JBCACHE-86.

          This may or may not be part of 1.2.1 (due within 1-2 weeks).


          - Lazy replication. When invalidated/uninitialized nodes are accessed on the clients, the data is retrieved transparently from the server cache.


          What do you mean ? This is provided by the CacheLoader model in JBossCache

          • 2. Re: Invalidation / Lazy Replication
            a b Newbie

             

            "bela@jboss.com" wrote:
            I have added a JIRA task to provide invalidate() across a cluster: http://jira.jboss.com/jira/browse/JBCACHE-86.
            This may or may not be part of 1.2.1 (due within 1-2 weeks).

            Excellent! Does this mean that invalidation is in CVS right now, or does it mean that it is not too hard to implement?

            "bela@jboss.com" wrote:

            "sdanig" wrote:
            - Lazy replication. When invalidated/uninitialized nodes are accessed on the clients, the data is retrieved transparently from the server cache.

            What do you mean? This is provided by the CacheLoader model in JBossCache.

            Right, but unless I'm mistaken, the only implementation of CacheLoader that delegates to another cache (DelegatingCacheLoader) can only delegate to a cache within the same VM. I'm looking for something like a RemoteDelegatingCacheLoader. Am I mistaken in my assumptions as to the limitations of DelegatingCacheLoader?

            Thanks in advance!

            Daniel Gredler

            • 3. Re: Invalidation / Lazy Replication
              Bela Ban Master

              #1 It is not in the CVS yet, as it is on the 1.3 roadmap. Not too difficult to implement though.

              #2 Yes, delegation currently only work within the same VM.

              • 4. Re: Invalidation / Lazy Replication
                a b Newbie

                I have added a comment to the invalidation feature request (http://jira.jboss.com/jira/browse/JBCACHE-86)

                I also added a new feature request (http://jira.jboss.com/jira/browse/JBCACHE-88) relating to a remote delegating CacheLoader implementation.