11 Replies Latest reply on Jun 24, 2011 9:37 AM by navs

    Large number of cache instances

    dror76

      Hi

       

      We are currently examining various ways of using Infinispan for a large scale multi-chat application .

      One of the ideas is to create a cache instance per chat room - is means that at peak time we will have tens of thousand cache instances.

      Our setup contains a varying number of servers on EC2 with Infinispan in replicated cluster mode (async).

       

      We are looking for someone who already experienced this kind of usage or has a banchmark showing that Infinispan can handle this amount of cache instances.

       

      Thanks,

      Dror

        • 1. Large number of cache instances
          manik

          We haven't tried this with tens of thousands of cache instances, but I don't conceptually see anything wrong with it provided you have enough memory and horsepower on each node.

           

          Quick question though, why not just use one cache for all of this, and "namespace" each entry by using "ChatroomName_<key>" as your key?

          1 of 1 people found this helpful
          • 2. Large number of cache instances
            ckulenk

            The DeltaAware/Delta interfaces may be of interest too. DeltaAware for a Chatroom, Delta for a message...

            1 of 1 people found this helpful
            • 3. Re: Large number of cache instances
              navs

              Hey

              I have a question on the same topic

              When a map of objects is maintained in the cache, and a object changes, is the whole object resent for replication or only the dellta part?

              The object are simple once with a few fields in it....

              • 4. Re: Large number of cache instances
                manik

                The whole object.  Unless your map is an AtomicMap, created using the AtomicMapLookup helper.

                • 5. Re: Large number of cache instances
                  navs

                  Hey Manik

                  Thanks for the reply!

                  I have one more question, If I use a nested AtomicMap will only the parent map be delta replicated or even the nested AtomicMaps will be delta replicated?

                  • 6. Re: Large number of cache instances
                    navs

                    another question, which is advisable a cache with structure <String,HashMap<String,SmallObject>>  or hundreds of caches, one for each SmallObject (keeping frequent changes to SmallObject and need to delta replicate them in mind).

                    Is there a big overhead in having many caches vs 1 cache?

                    • 7. Re: Large number of cache instances
                      ckulenk

                      Why not <KeyPath,SmallObject> with KeyPath={key1,key2,...} or something similar? I think massive amounts of caches aren't a good idea.

                      • 8. Re: Large number of cache instances
                        manik

                        AtomicMaps weren't designed to be nested.  I think this will cause issues.

                        • 9. Re: Large number of cache instances
                          manik

                          Yes, this is certainly a better option.

                          • 10. Re: Large number of cache instances
                            navs

                            Hey Manik

                            Thanks for you replies!

                            I am trying to implement a DeltaAware SortedSet (call it DeltaAwareTreeSet) for my application. Is is just enough to implement DeltaAware and Delta interface, and externalize delta object (call is TreeSetDelta)

                            I see AtomicHashMap has its own implementation of externalizer which is registered in Eternalizer class and mapped to it by ID assigned to AtomicHashMap.

                            If I create my delta aware SortedSet, how would I implement externalizer for my class?

                            • 11. Re: Large number of cache instances
                              navs

                              hey....the imlementaion worked fine!...never mind