4 Replies Latest reply on Jan 21, 2015 10:35 AM by dan.berindei

    Is Infinispan >= 7.0 suited as a 2-node JCache server ?

    steveerkel

      I asked a similar question at stackoverflow and now have come to the conclusion that Infinispan might suit my demand. Here you can find the key points from the posting:

      • caches in memory (overflow to disk would be nice to have though)
      • supports two nodes (more is better but not necessary)
      • compatible with Windows
      • "free" license
      • compatible with JCache / Spring Cache
      • "security" when reading / writing to the cache (JAAS, certificates, IP based, ...) (unfortunately running the Windows firewall to block clients is not allowed in my company)

       

      I read quite much about earlier version of Infinispan and it looks like it had problems then with split brain. As I did see in the blog this should be better now. But isn`t the behaviour of blocking access to data when a node goes offline a problem with a 2-node setup ?

      I want to cache data that is "expensive" to be read from a database in a distributed Cache.

      My setup will be:

      • two Windows servers running each a Tomcat 8 with some webservices behind a Apache 2.4.
      • the same two servers will run the Cache server (Infinispan in this case)
      • The two servers are fronted by a Loadbalancer

       

      When one of the servers goes offline the loadbalancer will direct all traffic to the remaining box. That box will then access the remaining cache server.

       

      Will I be able to keep users from accessing Infinispan by securing it with a password or alike ? Will I have problems with syncing / replicating the cache as soon as the second server goes online again ?

        • 1. Re: Is Infinispan >= 7.0 suited as a 2-node JCache server ?
          nadirx

          I think you should not be concerned that much about split brains if Infinispan is not the source of the data, i.e. you can reconstruct data from your primary datasource (your database).

          If you are using HotRod, it can be secured using SASL and/or SSL, so we support client-certificates, username/password and Kerberos. If you are using embedded you will have to provide a JAAS  Subject yourself and use the appropriate security APIs. Look at the blog posts: http://blog.infinispan.org/2014/04/infinispan-security-1-authorization.html and http://blog.infinispan.org/2014/07/infinispan-security-2-authorization.html for more information.

          • 2. Re: Is Infinispan >= 7.0 suited as a 2-node JCache server ?
            steveerkel

            I think I will rather run a standalone instance on each server. There is more than one component that builds the webservices so I will run each webservice component in a separate jvm and Infinispan alongside.

             

            Reconstruction is not my problem, I "fear" that I might not be able to get any data from the cache because I read (also on the blog) that it will block access if it considers the data stale. Serving "outdated" would be a minor problem (or better than not serving anything ;-)) as long as it gets updated when both  nodes are up again. Will Infinispan sync changes that were made after one node went offline ?

            • 3. Re: Is Infinispan >= 7.0 suited as a 2-node JCache server ?
              rvansa

              Partition handling is not enabled by default, therefore, unless you enable it the behaviour will be the same as in previous versions where the access is not blocked.

              When the nodes get up again (meaning that one of the nodes is really restarted), the data will be synchronized. However, without partition handling, if the nodes will just 'think' that the other node is down (due to network split, or even long GC), after merging those two together there won't be any synchronization and the data on one node could stay stale (this scenario is not tested very well, so I wouldn't surprised if some data got lost completely during the merge).

              • 4. Re: Is Infinispan >= 7.0 suited as a 2-node JCache server ?
                dan.berindei

                Assuming you use either replicated mode or distributed mode with numOwners = 2, data will not be lost when one node crashes / shuts down.

                 

                Radim is right, data can be lost if there are more nodes and after a (false) split brain one of the partitions ends up with zero owners for some of the keys. But in your case, there's only one way to split the cluster and both partitions will have all the keys, so you're safe.