2 Replies Latest reply on Mar 4, 2010 6:11 AM by timvb

    GUI demo invalidation mode configuration

      Hi all,


      For a presentation about Infinispan i'm trying to prepare 3 demos.

      Each demo will show a different cache mode. Distributed and Replicated caches modes works fine.

      Now i have some problems with the Invalidan cache mode. I use the GUI demo application.

      Here is my configuration:

       

      <?xml version="1.0" encoding="UTF-8"?>
      <infinispan
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="urn:infinispan:config:4.0 http://www.infinispan.org/schemas/infinispan-config-4.0.xsd"
            xmlns="urn:infinispan:config:4.0">

         <global>
            <transport clusterName="demoClusterInvalidation"/>
         </global>

         <default>
            <clustering mode="invalidation">
               <sync/>
               <stateRetrieval fetchInMemoryState="true"/>
            </clustering>
         </default>
      </infinispan>

       

      1) The configuration is loaded via the VM parameter -Dinfinispan.demo.cfg and displayed in the control panel.

      2) I start two instances of the GUI demo both nodes are part of the cluster.

      3) Next i put an entry in the first node with key "1" and value "Hello World"

      4) In the second node i put an entry with key "2" and value "Hello World".

      5) Both nodes just have one item in the cache just as expected

      6) Now i go to the first node and try to get the entry with key "2" that lives in the second node. I expect that the entry with key "2" will be retreived from the second node and appear in the data view of the fist node. But this isn't the case.

      7) Invalidation works fine because if i put an entry with key "2" with value "Updated Hello World" in the first node the entry in the second node will be invalidated an is no longer available.

       

      So actually the problem is in step 6. Please help me out so i can show the three different caching modes in my presentation.

      Cheers Tim

        • 1. Re: GUI demo invalidation mode configuration
          galder.zamarreno

          Invalidation is not distribution, so there's no remote lookups happening when you try to find a key that is not present in that node. Hence, your assumption in 6) is incorrect. 6) will only work if you have a shared cache store between the two cluster nodes. In that case, when 6) does not find it locally, it goes to the database and retrieves it.

           

          On a more general note, invalidation primarily makes sense in a environment when there's a persistent store from which u can retrieve data that might have been invalidated. Think of the Hibernate or JPA 2nd level cache. By default Infinispan configures entity cache with invalidation which means that when an entity is updated, it's removed from the cache in the other nodes. But, when this entity is requested in a node that does not have it, Hibernate goes to the database, retrieves it and puts it in the 2LC.

          • 2. Re: GUI demo invalidation mode configuration

            Ok thanks for your answer.

            Will make a modification in my presentation.

            Cheers Tim