4 Replies Latest reply on Feb 15, 2012 6:10 AM by Galder Zamarreño

    Distributed cache, single node write behind/through, failover if writing node goes down

    Andrew Le Gear Newbie



      We are looking at possibly using infinispan and were looking at the write behind functionality.   We are hoping to satisfy the following requirements, but are not sure if infinispan is configurable in this way (or if it is event supported)


      - Distributed (of course infinispan has this - writes on one node are reflected in the cache on another node, clustered using jgroups)

      - Write-through/write behind to backing store only happens on a single node.  While writes to the cache are distributed throughout the cluster,  we would like the write though/behind to write to our backing store only from a single node.   Our backing store is a database table. So we only want only one node writing the updated shared state.  I notice that using the "loader" config you can define a custom loader and store classes to handle this on each node.  I also notice in distributed mode you can set numOwners.  Bug If you have a single owner can you have only that owner write? is the owner effectively the "primary" node? Or do all nodes have to be writer in write behind/though mode?

      - Failover.  If our writing node fails, a new node in the cluster takes over and takes the role of writer.

      - Collision detection.  I notice that MVCC locking is used in infinispan - As an optimistic locking approach we need to guard against two nodes writing at the same time,  become aware of this and handle the collision (possibly have our application rerun the transaction if it notices a collision).


      Some guideance on the these requirements would be a great help.