7 Replies Latest reply on Apr 11, 2012 7:57 AM by kazaag

    JBoss AS7 cluster & http session cache

    ranga033

      How can I configure the http session cache to be on a remote server, so that in the event of a node going down, the backup node picks up the session data from a remote cache.

        • 1. Re: JBoss AS7 cluster & http session cache
          pferraro

          In general, a <distributable/> web application will replicate its session to the other nodes in your cluster, such that if that node goes down, its sessions will not be lost.  If you're specifically looking to store your session in a single remote location, you could replace the default <file-store/> within the infinispan subsystem's "web" cache container with a different cache store (e.g. remote database, remote cache, etc.) which stores the cache contents on a remote server.

          • 2. Re: JBoss AS7 cluster & http session cache
            ranga033

            Thanks Paul for the reply, Suppose I have a local cache on two nodes of AS7 instances connected to a remote store, and one node goes down after processing a request, I hope the other node would be able to process subsequent requests by picking the data from the remote store (as the local cache of Node 2 may have stale data or no data). ? Hoping that the data from remote store would get reflected on the local cache of Node 2  ?

            • 3. Re: JBoss AS7 cluster & http session cache
              pferraro

              Do you have a specific aversion to using a distributed cache store for web sessions?  That's how AS7 works by default - and it seems to adequately address your concerns about being able to failover a request.

              • 4. Re: JBoss AS7 cluster & http session cache
                ranga033

                Yes, I have constraint using distributed cache in a particular situation, hence exploring if local cache + Remote store would serve the purpose. I understand that AS7 works like that by default, which does not suit me in a specific case. Hence I am looking for alternative approaches and checking if Infinispan can be further extended/configured this way or not.

                • 5. Re: JBoss AS7 cluster & http session cache
                  kazaag

                  Hi,

                   

                  Can you describe your constains and requirement for HA, it will be easier to find a way to match them.  The use of a remote store will only send the fail over issue to an extra element, the remote store should also handle fail over.

                   

                  In cluster mode the session is not realy in a local cache but it is put in infinitspan which is a distrubuted data grid (can be view as HA store).  It is embeded in JBoss to improve latency when retriving data, no remote call needed.

                   

                  Usaly a Jboss cluster use session stickness, so each request of the same session is send to the same Jboss node.  When a new session is created, the session id is made in a way that one copy of the session data is stored on the node the request arived (Infinispan use a hashing mechanisme to get the list of node where the data are base on the key, in this case the session id).  This way any read to the session won't make any remote call.  In distributed mode the sessoin data will be present on at least 2 nodes (you can change the number of owner node if you need to), so each session data write will trigger copy to at least one other node.  You can also configure it in replication mode, in this mode the data will be present on each node, but you will lose loadbalancing capacity as it will increate the load and preven any scalling (in fact the more node you will add, slower it will get).

                   

                  This copy can be acyncronous (the copy occure after the request returns) to prevent latancy increase.  If the data copy is more impartant that latancy, you can made it in sycnronous mode, this way the request will return after the copy traiding latancy for copy safty.

                   

                  In the case one node is not avalable, the request will end on another node.  When trying to get the session data in Infinispan, Infinispan will detect the data is not presen in this node and, as it is a distributed grid, it will request the data to the node where it is (the copy node as the other one is down).

                   

                  In the backgroud, Infinispan will detect the carsh and trigger a new copy of the session data on another node.

                   

                  So JBoss provide local cahe and distributed remote store on one system.

                   

                  PS: If I understand something wrong, please correct me.

                  • 6. Re: JBoss AS7 cluster & http session cache
                    ranga033

                    Thank you François  for the detailed reply. Apologies for the delay.

                     

                    I understand that distributed mode is the best way in this case. The question that comes to my mind is where does the remote-store come into picture. As you have mentioned -

                     

                    In the case one node is not avalable, the request will end on another node.  When trying to get the session data in Infinispan, Infinispan will detect the data is not presen in this node and, as it is a distributed grid, it will request the data to the node where it is (the copy node as the other one is down).

                     

                    In the above scenario the embedded cache in each of the JVM which are already in distributed mode handles this without any problems. I am just interested to know where does the Remote-Store fit into the picture.

                     

                    (Basically I was looking for a way for all the nodes to talk to a remote cache and not embedded cache)

                    • 7. Re: JBoss AS7 cluster & http session cache
                      kazaag

                      It is a remote capable cache embedded in Jboss.  This way if the data are on the node, no need to add the cost to send the data over the wires.

                       

                      I don't think (at least I don't know how to do it) it is possible to update Jboss config to use a  remote Infinispan cluster.

                       

                      If you realy need it you can probably change the session management to use a different data grid cluster (and use current code to use Infinispan, probaly reduce the effort).  The other option is not use the servlet session mechanisme and use your own session management.

                       

                      The think is that I don't see a use case where the decoupled remote cache can give you real benifits for non persistant data (Servlet session have a limite time live).

                       

                      François