2 Replies Latest reply on May 16, 2013 8:03 AM by cotton.ben

    Advantage of HotRod Hash-distribution-aware client API?

    cotton.ben

      Let's say I have a 4-node Infinispan 5.3 grid configured as DIST_SYNC.  I implement the org.infinispan.distribution.group.Grouper<T> interface so that I can segregate and "pin" a subset of of my application use-case's Keys in my Cache<K,V> to *exactly* 1 node on my grid.  This works well.  My Grouper<T> indeed pins the Keys subset to exactly 1 node, and I use the regular Infinispan default Cache API (from my Client view) to transparently operate on my 4-node DIST_SYNC grid.  Again, everything works well.  However, My Infinispan readings  have now taken me to an encounter with the "HotRod Hash-distribution-aware client API" and its intellegence to allow the client to "know" the "data owner" node on which to operate. 

       

      What considerations would I have in making a decision as to when  to use  HotRod Hash-distribution-aware client API operations to retrieve "pinned to 1 node" data (vs. the regular Infinispan default Chace API)?

        • 1. Re: Advantage of HotRod Hash-distribution-aware client API?
          mgencur

          Hello Ben,

          let me try to answer this question.

           

          The main difference between using HotRod client API and the default Cache API (with Grouper interface) in terms of data distribution is that with the Grouper API you can say which keys will be stored on the same node (by ensuring the same hash/group). However, you cannot get this done simply by using HotRod client API. HotRod client  uses the consistent hash algorithm to compute the owner of the key, but this is based on key's hash, not on key's group. So you cannot easily group keys to one node.

           

          Also, for the HotRod client, there's additional round-trip between the client and server, including marshalling of data. Using the default cache API might be then faster under certain circumstances. These are two different usage modes (client-server, library), with respective advantages and disadvantages, which serve different purposes.

           

          Martin

          • 2. Re: Advantage of HotRod Hash-distribution-aware client API?
            cotton.ben

            Thanks Martin.   Insights appreciated.