4 Replies Latest reply on Feb 3, 2016 8:47 AM by udit-mishra-5113a21a

    How memory is managed in distributed caching?

    udit-mishra-5113a21a

      I have few questions.

       

      1.) The documentation says, in distributed cache, keys are stored on some nodes(not all). I want to know, given a certain size of the cluster say n, what can be the number of nodes on which these copies will be stored? Also, how nodes are chosen?? I mean, what factors are taken into consideration while choosing such nodes??

       

      2.) We are using distributed cache in domain mode with two nodes. One is domain controller and the other is host controller. We have set maxEntries to -1 which means no limit on entries. If I am keep on putting data, at what time the cache gets filled up?? And what happens if it gets filled up completely?? can I know the cache size or is there any way I can get notified (client) that the cache is about to reach its limit??

       

      3)  Lets say if I have set maxEntries set to 100, and I have two nodes as per the above configuration. Will domain controller node also store data? And If yes, then using this cluster, at the max I can store 200 entries, since its distributed, right?

       

      4) What will happen if all the nodes on which the distributed copies were stored went down. Will client still be able to get data??

        • 1. Re: How memory is managed in distributed caching?
          nadirx

          1) Hi, you will want to read http://infinispan.org/docs/8.1.x/user_guide/user_guide.html#_distribution_mode as it contains detailed information about distribution, consistent hashing, owners, etc.

          2) Without setting up eviction or expiration, you will get an OutOfMemoryError. Determining the memory occupation of entries in Java is tricky, but we do support eviction based on memory size which is quite accurate especially in client-server mode. If you don't want to lose entries when they are evicted from memory, set up a cache store and enable passivation.

          3) Bear in mind that the DC contains no data. However, the node running the DC may also be running an actual server, and that will hold data. Eviction (number of entries or memory occupation) is per-node, so you need to multiply by the number of nodes and divide by the number of owners to get the actual number that is possible to store.

          4) You can configure a distributed cache to be available or consistent in these cases. Read http://infinispan.org/docs/8.1.x/user_guide/user_guide.html#_partition_handling for details

          • 2. Re: How memory is managed in distributed caching?
            udit-mishra-5113a21a

            Regarding the point 2, how can we specify eviction based on memory size?? as I can see in the docs, it is based on the number of entries i.e. <eviction wakeUpInterval="500" maxEntries="2" strategy="LRU"/>

             

            Regarding the point 3, if host.xml of the node which is running a domain controller contains a entry in , then only it will store data, right?

             

            Additionally, is there any document which specifies all the available options of attributes of various subsystems of domain.xml?

            • 3. Re: How memory is managed in distributed caching?
              nadirx

              Eviction size is configured as follows:

               

              <eviction size="20000000" type="MEMORY" strategy="LRU"/>
              

               

              which will configure 20MB.

              Use the schema reference documentation for more details: https://docs.jboss.org/infinispan/8.1/configdocs/infinispan-config-8.1.html

               

              As for the domain controller / host / server relationship, I think I need to clear things up:

              - the domain controller (DC) is a very simple process: it does not contain any data. It reads the domain.xml to "assign" the configuration to the actual servers belonging to the various server groups. To do this it talks to the host controllers on other physical nodes. The domain controller can also act as a host controller for server running locally to it.

              - the host controller is a process running on every host: it connects to the DC and provisions the servers on its own node. Similarly to the DC it does not actually contain any data. It is configured by host.xml.

              - the server is the actual Infinispan node.

              • 4. Re: How memory is managed in distributed caching?
                udit-mishra-5113a21a

                Alright, understood now. Thanks