6 Replies Latest reply on Oct 22, 2005 6:01 AM by sunnymoon

    EJBs on different nodes

    sunnymoon

      Is there a way to publish some EJB's to only some nodes in a cluster? Although the documentation heavily discourages it, our framework really needs it badly, because some machines are actually much faster then others...
      Consider three ejbs : RealTimeEJB1, BatchEJB2 and SharedEJB3
      I wanted RealTimeEJB1 to run only on node1 and BatchEJB2 to run on node2, while SharedEJB3 to run on both nodes? Is there a way to achieve this? Has that some thing to do with partitions and cluster-config partition name in jboss.xml file?

      Thank you all
      Sunny

        • 1. Re: EJBs on different nodes

          If you deploy EJB1.jar to node1, EJB2 to node2, etc, wouldn't it do what you want?

          -Ben

          • 2. Re: EJBs on different nodes
            sunnymoon

            So I can not use farm directory to hot deploy across the cluster
            and use cluster-config partition to tell were I want my beans to be instantiated?

            This was the kind of setup I was trying to achieve...

            Maybe if all the nodes were on the same partition (DefaultPartition) but then relating to EJBDeployment, each node had its own configuration.

            Imagine the other following scenario:
            node1 and node2 are a group (group1)
            node3 and node4 are another group (group2)

            I have the following EJB's
            Group1EJB1 -> should run clustered on node1/node2 (Group1)
            Group2EJB2 -> should run clustered on node3/node4 (GRoup1)
            SharedEJB3 -> should run clustered on node1/node2/node3/node4 (All nodes)

            Is there a way to do this?

            Most appreciated for your quick reply

            Sunny

            • 3. Re: EJBs on different nodes
              brian.stansberry

              You're going to need 3 partitions -- "Group1", "Group2" and "DefaultPartition" (which JBoss provides for you). Chapter 3 in the Clustering docs explain how to configure a partition. You'd need to deploy your, for example, group1-partitiion-service.xml on nodes 1 and 2, and your group2-partition-service.xml on nodes 3 and 4. Farming can't help you with this.

              You can also create your own separate instance of the farming service that will work with your new partitions. Chapter 7 of the Clustering docs explain how to do this. You'd have a farm service associated with your group1 partition, which would look in a directory called, for example, group1-farm for files to deploy to its partition. Equivalent thing for group2. You'd need to deploy your, for example, group1-farm-service.xml on nodes 1 and 2, and your group2-farm-service.xml on nodes 3 and 4. Again, the default farming can't help you with this, as you need to restrict deployment to certain nodes.

              Once all this is done, you can drop your Group1EJB1 in your group1-farm directory and it will be deployed on nodes1 and 2. Equivalent thing for Group1EJB2. SharedEJB3 is deployed to the standard farm folder.

              • 4. Re: EJBs on different nodes
                sunnymoon

                Thanx for your reply...Many, many thanx... This is why we chose Jboss... Such a nice AS, such nice people...

                I assume from your answer that
                1. Both groups1 and groups2 will have also the same cluster-service.xml file that define all properties for the DefaultPartition
                2. group1 will have group1-partition-service.xml based on cluster-service.xml substituting DefaultPartition by Group1, for example... same for group2

                What I couldn't understand was farming... If I deploy say Group1EJB1 on the default farming directory it should be deployed to all nodes, independently of the partition to which they belong, right? So if I configure the parameter cluster-config->partition-name in the jboss.xml file to be Group1 and even though the jar file is everywhere across cluster, shouldn't it be instanciated only on the nodes that belong to partition Group1?

                Either way I'll try both configurations...

                Thanks once again

                Sunny

                • 5. Re: EJBs on different nodes
                  brian.stansberry

                  If you deploy a copy of the whole cluster-service.xml file, you're going to deploy more than just a partition; i.e. another HA-JNDI, etc. To get the farming to work, just deploy the cluster partition MBean. Whether you want a separate instance of things like HASessionStateService, cache invalidation bridge, etc. really depends on the architecture of your app and is probably too complex for a forum discussion.

                  Do you just want to deploy certain beans on certain nodes, but have them visible via JNDI from all nodes? If so, just do the farming part, and leave the <partition-name> element in each bean's jboss.xml set to DefaultPartition. This has the same effect as if you'd deployed Group1EJB1 to node1 and 2 without using farming.

                  In the partition config for your group1 & 2 partitions, don't just change the partition name. Also change the multicast address and port in the UDP section of the config. Otherwise the low-level JGroups protocols will have to process and discard packets meant for the other partitions.

                  Re: farming, if you use the general farming service to deploy your group1 & 2 farm services, JBoss will try to deploy the group1-farm-service.xml on a machine with no group1 partition, and the deploy will fail.

                  • 6. Re: EJBs on different nodes
                    sunnymoon

                    Thanks for your reply! Most appreciated, really...
                    I'll try this and then inform of any progress...

                    Sunny