2 Replies Latest reply on Jun 2, 2010 3:15 PM by Paul Hinds

    Documents on setting up an Invalidating cache

    Paul Hinds Newbie

      Hi I have been hunting around infinispan docs first I promise

       

      We want to do a JBossCache port to Infinispan and our existing cache has bespoke (urgh) invalidation bolted into an early version of JBossCache (long story).

       

       

      We essentially want a cache of Database entities, and want to invalidate these, when they change, without distributing the data across the cluster.  We want very cheap put()s, which JBossCache can not really provide.  Infinispan seems a good fit.

       

      So we need to be able to

       

      Insert current data (not do any invalidations) but put() invalidates? What is the method to make a local put() that does nothing over the network? A pointer to a document or the code would be helpful.

       

      When we change the state we call put() and get Infinispan to invalidate for us with no hacking , cool.

       

      We also want to use the new funky async methods to be able to handle errors asynchronously, currently we do log minitoring.

       

      So we would call putAsync() or removeAsync() and handle Exceptions in a separate thread.

       

      Where can I find details of Exceptions throw?

       

      JavaDocs just say

      Throws:
      IllegalStateException - if the cache is not in a started state.

      Which is clearly not the whole story

      In JBossCache we have frequent (once a week) problems with a put() going wrong, if we use async puts we need to be able to determine what went wrong and how to fix.

       

      If one of the cluster members is offline for a while, we want to sent a durable message so that when it comes back it evict()s invalid entries. 

      This is for the wierd case when a JVM under really heavy load stops responing, GC sakes too long etc, but OS stays up and eventually JVM comes back and starts handling web requests with stale data since JBossCache has given up on it.

       

      So we would like be able to determine the node that failed from the Exceptions, is that possible?

       

      Or does inifinspan handle this type of error itself?  Is the doc somewhere on what can and can not happen in anomaly situations?

       

      cheers in advance

       

      P

        • 1. Re: Documents on setting up an Invalidating cache
          Manik Surtani Master

          We essentially want a cache of Database entities, and want to invalidate these, when they change, without distributing the data across the cluster.  We want very cheap put()s, which JBossCache can not really provide.  Infinispan seems a good fit.

           

          So we need to be able to

           

          Insert current data (not do any invalidations) but put() invalidates? What is the method to make a local put() that does nothing over the network? A pointer to a document or the code would be helpful.

          try:

           

          cache.getAdvancedCache().withFlags(Flag.CACHE_MODE_LOCAL, Flag.SKIP_REMOTE_LOOKUP).put(key, value);

           

          We also want to use the new funky async methods to be able to handle errors asynchronously, currently we do log minitoring.

           

          So we would call putAsync() or removeAsync() and handle Exceptions in a separate thread.

           

          Where can I find details of Exceptions throw?

          The async() methods return a Future.  When you call Future.get(), this may throw an ExecutionException which will wrap any underlying exception.

           

          If one of the cluster members is offline for a while, we want to sent a durable message so that when it comes back it evict()s invalid entries. 

           

          This is for the wierd case when a JVM under really heavy load stops responing, GC sakes too long etc, but OS stays up and eventually JVM comes back and starts handling web requests with stale data since JBossCache has given up on it.

           

          So we would like be able to determine the node that failed from the Exceptions, is that possible?

          Hmm, sounds like you need to tune your JGroups failure detection to detect such lags and to make sure any messages are delivered.  Have a read of FDVersusFD_SOCK.

           

          HTH

          Manik

          1 of 1 people found this helpful
          • 2. Re: Documents on setting up an Invalidating cache
            Paul Hinds Newbie

            With that one liner I think we are probably good to go, at least for a PoC.

             

            We both FD vs FD_SOCK running in the JGroups stack and that works quite well.

             

            But now you come to mention it, the problem in JBossCache is there is a trade off between failing fast enough to not hang the system and catching errors.

            With these async methods that trade-off is no longer ther, we just let JGroups keep trying.

             

             

            Thanx Manik for the prompt reply.

             

             

            P