4 Replies Latest reply on Sep 23, 2010 12:01 PM by galder.zamarreno

    Group Operations in Cache

    girishadat

      I am doing a migration from JBoss POJO Cache to Infinispan for a distributed application. We had faces many memory problems with PojoCache and finally decided to  move to Infinispan. What we used is the tree like representation of POJO cache and not the field level replication. I've evaluated the tree plugin for ISPN, but it found to be very slow to use for our business. Now I am migrating the code to plain ISPN; not the tree version.


      During the migration of the application code for this change, we faced many problems as usual in a migration process where the source and destination systems does not share the same/similiar APIs; but we could manage most of them at application's side. Now I am confused to see the ISPN's Cache APIs, values(), keySet() and entrySet() documented with the sentence - "This method should only be used for debugging purposes such as to verify that the cache contains all the mappings entered. Any other use involving execution of this method on a production system is not recommended." . Why it is not recommended? We were using JBC group APIs like findAll(), removeAll(), getChildren() ... etc. in previous version of the distributed application.


      I think in most of the business scenarios that uses a Map implementation for data storage uses keys that are dynamically generated, which can be coming inside the systems from some external systems. So, is there anyway for accessing the data in Infinispan, if the client application which makes use of Infinispan does not know the key in which an object is stored in the cache? It would be good if ISPN allows to iterate over the keyset in some way.

        • 1. Re: Group Operations in Cache
          girishadat

          Happy to see some information here - http://community.jboss.org/wiki/UsingtheCacheAPI#Limitations_of_Certain_Map_Methods

           

          "Specifically, these methods are unreliable and only provide a best-effort guess.  They do not acquire locks, either local or global, and concurrent modifications, additions and removals will not be considered in the result of any of these calls.  Further, they only operate on the local data container, and as such, do not give you a global view of state. Attempting to perform these operations globally would have large performance impact as well as become a scalability bottleneck.  As such, these methods should only be used for informational or debugging purposes only."

           

          I hope I can use keySet() method "reliably" (its relative to my application. it just uses the data from keyset for querying, which repeats in frequent intervals... also I can compromise on locks, concurrent modifications) with async replication mode for ISPN. Also, as it is replication mode, there is no significance for local-global issue. Am I correct? Also, is there anything else that I can expect? Other than a slight high memory use, which is again compromised by the use of only keys (keyset()).

          1 of 1 people found this helpful
          • 2. Re: Group Operations in Cache
            galder.zamarreno

            If you use replication and want to call keySet(), it's not a big problem cos all nodes have all keys, so you'll really get all keys. With distribution this would not be the case. If you need querying, you should have a look at the Query module (http://community.jboss.org/docs/DOC-14155)

            • 3. Re: Group Operations in Cache
              girishadat

              Thanks Galder. I am using async replication and I don't want the keySet() to create locks unnecessarily. So I think it is going to work perfectly for my use case.

               

              My application needs to work in a near real-time manner and hence I need the cache operations faster. Thats why I went for async option. Also, I think query module can work if I have some knowledge on the keys/values I store. Both are dynamically created in this enterprise application. And I fear it can reduce the speed of a get from cache operation again.

               

              BTW, do Infinispan/JBossCache has any users list? Like the one Apache Hadoop has @ http://wiki.apache.org/hadoop/PoweredBy? Such a list can reduce the fear I (and many others?) face sometimes, i.e. "Am I using the right clustering framework?"

              • 4. Re: Group Operations in Cache
                galder.zamarreno

                Girish Adat wrote:

                BTW, do Infinispan/JBossCache has any users list? Like the one Apache Hadoop has @ http://wiki.apache.org/hadoop/PoweredBy? Such a list can reduce the fear I (and many others?) face sometimes, i.e. "Am I using the right clustering framework?"

                Not sure I understand your question. These forums are the Infinispan user list.