6 Replies Latest reply on Sep 9, 2014 11:58 AM by wdfink

    JBoss clustering for an application with custom caching

    ziadrb

      Greetings,

       

      I have an application that I want to cluster on two JBoss nodes.

      This application connects to an Oracle DB and fetches everything and puts it in RAM (the custom cache part) when its package is deployed. It doesn't use JBoss cache and its architecture was designed without any regard to clustering. The requirement is clustering on two nodes, which is basically used just for fail-over if a node goes down.

       

      I tried the following:

      Started both JBoss nodes with standalone-ha.xml

      Started apache with mod_cluster on a 3rd node as the load balancer.

       

      This worked as expected, the http session switches to the next node if the first fails.

       

      I have a couple of questions about mod_cluster. Does mod_cluster do load balancing (sharing the load) between the two nodes? or does it just connect to one node and then fail-over to the other if the first goes down? Because if it shares the load, there might be some inconsistencies in the cache and I'm not sure this solution will work out.

       

      I am thinking of an active/passive setup because if node A fails and node B is already started, B won't be having the latest data from the DB (as the data is only loaded to cache on startup/deployment) so the application needs to be redeployed in this case.

       

      So I'm wondering if this is doable in mod_cluster, like e.g. have only one node deployed, and if this node fails, the second node will get deployed, thus loading the latest data. Like e.g. having an event handler that will trigger if a node fails then it runs a script or some command that I feed for the other node to redeploy.

      I can't find much info online regarding mod_cluster

       

      Any help or advice is appreciated.

       

      Regards

        • 1. Re: JBoss clustering for an application with custom caching
          wdfink

          Not the expert for mod_cluster, but in general it do a load-balancing.

          From my perspective the problem is more the caching as you have one node with outdated data which is worse in case of LB and failover as well.

           

          I would reconsider the approach and implement a mechanism to trigger a reload or better to update only the changes which are done in the DB.

          Also you can use JDG as a clustered cache which might help you to have the same data within the cluster.

          • 2. Re: JBoss clustering for an application with custom caching
            ziadrb

            I forgot to mention that I'm trying to find a solution as is, meaning without any changes to the application itself.

             

            I want such mechanism (reload trigger), that's why I was asking if mod_cluster can help in this case.

             

            Also, I am not sure what JDG stands for.

             

            Thanks

            • 3. Re: JBoss clustering for an application with custom caching
              wdfink

              You might have something outside of JBoss which check the node healthy and start the standby node in case of failure.

              From my perspective not the best solution as you have the instance most time offline (no benefit) and there is a gap between failure and availability of the backup instance.

              Also it might possible that the first node is blocked or unreachable for mod_cluster but the process is still alive.

               

              So I would run both nodes active handling request and only have a monitoring for failure. A good monitoring tool will be JON (JBoss Operation Network) for this, it will monitor and restart the nodes if crashed.

              Another option is to use the Domain mode, I suppose you use EAP6 as you post here, with that mode it is easy to administrate the configuration and a crashed node will be restarted imediatly.

               

              For the cache sync I would recommend to implement a refresh mechanism, i.e. use a timer and check the DB data version and reload if necessary. Other option is to do it active by trigger the application if the DB has changed.

               

              JDG stands for JBossDataGrid and is the Enterprise version of Infinispan cache

              • 4. Re: JBoss clustering for an application with custom caching
                bishtsand

                HI Nore,

                 

                Few year back, i was in same situation.

                I picked J-Groups and implemented it in our code.

                 

                1 it detect one of the node is went down in cluster.

                2. If Master node is down, at receiver of Slave node, you can trigger your ORACLE Database code.

                3. If required you can replicate your cache between Master and Slave. (ACTIVE-ACTIVE).

                 

                Also, J-Groups Maintenance is easy.

                 

                if require, you can use mod_jk for HTTP session stickiness (ACTIVE-ACTIVE) instead of mod_cluster.

                • 5. Re: JBoss clustering for an application with custom caching
                  ziadrb

                  @Wolf-Dieter Fink

                  I tried Domain mode, and I see it as the way to go. But I am still finding a way to catch a trigger of node failure. You mentioned that it can be done in Domain mode, can you please elaborate?

                  Also, if JBOSS clustering load balance between the nodes, then I don't think this whole thing would work out, because as I mentioned, the two nodes will then have inconsistent data (due to cache).

                   

                  @Sandeep Bisht

                  Unfortunately, I can not do anything to the code, the situation is going to be the same. But J-Groups do seem interesting.

                  • 6. Re: JBoss clustering for an application with custom caching
                    wdfink

                    Domain mode will only start the failed node. There is no trigger for other processes.

                    What I meant was to have both nodes in sync and under load. So you need to have a mechanism to keep both nodes in-sync