4 Replies Latest reply on Jul 9, 2010 7:44 AM by galder.zamarreno

    How to configure Fail-over of Infinispan server?

    alartin

      Hi All,

       

      As my understanding, we can setup two kinds of Infinispan server to let data grid users access the data stored in Infinispan cache:

      1. Rest server which is running on the top of JBoss AS
      2. Hot Rod/Memcached server

       

      I know that as a distributed cache, infinispan can work well when one cache node fails, our data will not be lost and can be accessed from another cache node transparently. My concern is when we use the infinispan server mentioned above, how can we avoid single point failure of such kind of infinispan server? how can we make load balance of multiple infinispan servers if possible?

      My draft idea is to set up an apache server at the front and set up another standby machine for it, then set up multiple JBoss AS for inifinispan rest server and let apache make load balance. But I'm not sure if the infinispan rest server is distributed natively and how to achieve it if I use Hot Rod/Memcached server.

      Any help will be appreciated.

        • 1. Re: How to configure Fail-over of Infinispan server?
          manik

          More clearly, you have 2 styles of interaction with Infinispan:

           

          1.  Embedded (p2p)

          In this scenario, there is no Infinispan server, but Infinispan caches reside in your application's JVM.  These instances discover peer nodes and form a cluster and share/distribute state.

           

          2.  Client/server

          This involves one of the 4 server types we ship with:

          • REST
          • Memcached
          • Hot Rod
          • WebSockets (experimental)

           

          In all of these cases, the server backend creates an embedded Infinispan instance and if you start multiple backends, they will form a cluster and share/distribute state as described earlier.  The server types I listed above is just the type of listener endpoint that is started to handle incoming connections.

           

          WebSockets is very HTML5 specific, and uses a Javascript client library to run in a browser, I won't talk about that too much.

           

          As for the others, load-balancing at its simplest is, as you suggest, using Apache with mod_cluster or something.  Specifically when it comes to the REST server, this will work well.

           

          For the memcached server, some client libraries provide built-in load-balancing (perl's Cache::Memcached for example), but in general this is deemed to be a client-side issue.  Although I believe you could do this using mod_cluster with some hacking.

           

          As for Hot Rod, this is where things get interesting.  Hot Rod was designed for implicit load balancing and failover, and the protocol exposes enough information with which you can build smart clients - clients that have the ability to load balance, fail over, and even do smart routing of requests to relevant back-end nodes.  Infinispan ships with a Java-based reference impl Hot Rod client that does all of this.

           

          Hope this helps

          Manik

          • 2. Re: How to configure Fail-over of Infinispan server?
            alartin

            Hi Manik,

             

            Thanks for your quick reply. I found RemoteCacheManger's constructor:

             

            public RemoteCacheManager(String servers,
                                      boolean start)

            The given string should have the following structure:  "host1:port2;host:port2...". Every host:port defines a  server.

             

            So, only list all my nodes (host+port) in config file, my client will be smart to handle single point failure and load balance, right? Say, I can have 3 servers for incoming requests and 100 cache nodes for cache data. Correct me if I am wrong.

            If I need to provide such data grid service to other languages, it is recommanded to use REST servers and use the solution I mentioned above so far, right?

            • 3. Re: How to configure Fail-over of Infinispan server?
              manik

              So, only list all my nodes (host+port) in config file, my client will be smart to handle single point failure and load balance, right? Say, I can have 3 servers for incoming requests and 100 cache nodes for cache data. Correct me if I am wrong.

              Yup, that's right.  You also don't need to provide the addresses of all of your servers that listen for Hot Rod connections, since this information is sent from the server to the client when the first connection is made, and when changes occur on the backend.

               

              If I need to provide such data grid service to other languages, it is recommanded to use REST servers and use the solution I mentioned above so far, right?

              REST works, and so does memcached (lots of memcached client libraries available). 

               

              You can also use Hot Rod for this in theory, since Hot Rod is a platform-independent protocol.  It's just that we only have a Java client at this stage, although I know of some efforts around a Python client.  If you feel like contributing more clients for Hot Rod, here is the protocol spec to follow.    The Java client source code can be referred to as a client implementation guide as well.

              • 4. Re: How to configure Fail-over of Infinispan server?
                galder.zamarreno

                Sean, I've just finished writing an article giving an overview of the Infinispan Server Modules.

                 

                Hopefully the article answers the questions you had and maybe even answers questions you might have in the future

                 

                Feedback appreciated