3 Replies Latest reply on May 2, 2008 1:17 PM by manik

    eviction, clustering without cacheloader

    nnnnn

      It seems to me that you've got a bug with the way that you treat evictions - data integrity is only maintained if there's a CacheLoader backing the cache.

      I say this, because the javadoc on CacheImpl.evict(Fqn) method (2.0.0, at any rate) includes: "Note that eviction is done only in local mode, that is, it doesn't replicate the node removal. This will cause the replication nodes to not be synchronizing, which is fine since the value will be fetched again when get returns null".

      This is a problem for us. We don't have a backing CacheLoader, all of the state is in the Cache. We'd like the nodes to be evicted from all machines at the same time (it would be really nice if this were based on the last read time in any server in the cluster). As it is, it's going to be very random behavior - different servers have different times for their most recent read, so different servers are going to evict at different times.

      Suggestions?

        • 1. Re: eviction, clustering without cacheloader
          manik

          Try using an ExpirationPolicy? Then as long as you have sync clocks between the servers they would all be evicted at the same time. Of course, you don't get the benefits of the other policies that way.

          • 2. Re: eviction, clustering without cacheloader
            nnnnn

            Hmmm. Probably won't quite work for us - we need the timeToLiveSeconds behavior in LRU policy. To mimic that, we'd need to set a new ExpirationPolicy time on every get, which would kill performance (due to replication).

            One thing that I'm thinking is adding a ClusteredCacheLoader. So if one server evicts too soon (due to node having been read on a different server recently), the ClusteredCacheLoader will get it from the other cache. When a node is evicted on all servers in the cluster, then it's when we really wanted to evict.

            Does that sound like it might work? Question about ClusteredCacheLoader, since I've never used it. If we've got 4 servers in the cluster, and a node has been evicted from 3 of them, are we okay? Does the ClusteredCacheLoader search all other servers in the cluster until it finds the node?

            • 3. Re: eviction, clustering without cacheloader
              manik

               

              "nnnnn" wrote:
              Does that sound like it might work? Question about ClusteredCacheLoader, since I've never used it. If we've got 4 servers in the cluster, and a node has been evicted from 3 of them, are we okay? Does the ClusteredCacheLoader search all other servers in the cluster until it finds the node?


              I'm not sure if it will work, it really depends on the details of your use case. :-) I'd say give it a go though.

              Regarding searching all nodes, yes it does. It broadcasts a clustered get call, and then filters the results using a response filter (see the inner class, ResponseValidityFilter on the ClusteredCacheLoader).