3 Replies Latest reply: Mar 18, 2013 10:53 AM by Jonathan.Knight RSS

    Near caching advice

    richcoleuk
      Just wanted some advice on the following use case.

      We currently have a cluster of 8 Coherence storage nodes and 2 extend nodes running on a single machine. I then have another machine with 16 java processes that are clients of the extend nodes running in the main cluster.

      Currently there is no state stored on the client side and every request goes back over the network to the main cluster. So something like:

      client.get("A") // network trip to get A
      client.get("B") // network trip to get B
      client.get("A") // network trip to get A
      client.get("B") // network trip to get B

      I'm looking at some kind of near caching so that you can improve on that by having something like:

      client.get("A") // network trip to get A
      client.get("B") // network trip to get B
      client.get("A") // A is already in the near cache so no need to go across network
      client.get("B") // B is already in the near cache so no need to go across network

      Could someone please confirm if <near-cache/> does the above out the box?

      To take it further, is it possible share near caches so that if one of the 16 processes loads an object, it's then available on the machine to the other 15? So something like:

      processOne.get("A") // network trip to get A for process one
      processOne.get("B") // network trip to get B for process one
      processTwo.get("A") // no network trip as A has already been loaded by process one there it's available to process two

      Many thanks

      Richard
        • 1. Re: Near caching advice
          User738616-Oracle
          Hi Richard,

          Please find the answers inline:
          richcoleuk wrote:
          Just wanted some advice on the following use case.

          We currently have a cluster of 8 Coherence storage nodes and 2 extend nodes running on a single machine. I then have another machine with 16 java processes that are clients of the extend nodes running in the main cluster.

          Currently there is no state stored on the client side and every request goes back over the network to the main cluster. So something like:

          client.get("A") // network trip to get A
          client.get("B") // network trip to get B
          client.get("A") // network trip to get A
          client.get("B") // network trip to get B

          I'm looking at some kind of near caching so that you can improve on that by having something like:

          client.get("A") // network trip to get A
          client.get("B") // network trip to get B
          client.get("A") // A is already in the near cache so no need to go across network
          client.get("B") // B is already in the near cache so no need to go across network

          Could someone please confirm if <near-cache/> does the above out the box?
          Yes, near-cache is meant for it.
          To take it further, is it possible share near caches so that if one of the 16 processes loads an object, it's then available on the machine to the other 15? So something like:

          processOne.get("A") // network trip to get A for process one
          processOne.get("B") // network trip to get B for process one
          processTwo.get("A") // no network trip as A has already been loaded by process one there it's available to process two
          No this is not possible with near-cache. If the data changes in the main cluster then the data in the near-cache(client side cache) will be invalidated.
          Many thanks

          Richard
          HTH

          Cheers,
          _NJ                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
          • 2. Re: Near caching advice
            richcoleuk
            Hi,

            Thanks for your response.

            "No this is not possible with near-cache. If the data changes in the main cluster then the data in the near-cache(client side cache) will be invalidated."

            In that example the data doesn't change at all. What I mean is that process two can already benefit from the fact that process one (running on the same machine) has already loaded the data.

            Richard
            • 3. Re: Near caching advice
              Jonathan.Knight
              Hi Richard,

              Regarding your first scenario, yes that is how a near-cache works, so the first get for a key is a network call and subsequent gets are local calls (providing the data on the server has not changed). There are various ways to size limit and expire entries from your near cache that you might need to look at as otherwise you would run out of space in the near-cache as it is unlikely to be able to hold the whole back end cache. Only gets and puts are near cached, other calls like filter queries and aggregations etc always go to the cluster.

              Regarding your second scenario - out of the box there is not a way to do this. I once saw a team do a POC with this type of logic by having a single process on the boxes with the multiple client processes that is an extend client to the main cluster with near caches configured. This process also exposes a extend proxy service of its own. The other processes on the same physical box then connect over extend to this process rather than the main cluster. It was quite a while ago so I cannot remember if they actually went forward with this or if it actually gave them anything over just normal near caches.

              JK