1 Reply Latest reply on Aug 22, 2011 7:19 AM by wolfc

    Local vs Remote EJB interfaces in a cluster

    david_b

      Hi all,

       

      Quick question:

      Do I need to use remote EJB interfaces when deploying in a clustered environment?

       

      Some background:

      I have an application with a number of EJBs using local interfaces. Most EJBs are injected using the @EJB annotation. Some are looked up manually from POJOs using JNDI. They don't need to be callable from external clients.

       

      This works flawlessly when running on a single server in a single JVM. What about in a cluster where there are multiple JVMs involved? Will the container or a JNDI lookup ever return an EJB instance from a different JVM? If so, will the container proxy local calls if they traverse JVMs?

       

      I've had a search around but can't get a definitive answer. I'd prefer to stick with local interfaces for performance reasons.

       

      I'm using JBoss AS 6.1.

       

      Thanks in advance,

      Dave

        • 1. Re: Local vs Remote EJB interfaces in a cluster
          wolfc

          Clustering of local views makes no sense. Apart from the fact that it would be impossible to call by reference.

           

          Even calling clustered remote views on another makes no sense. Let me elaborate on that.

           

          Lets suppose we have a cluster which consists of two nodes: A and B, on which we deploy GreeterBean which calls PersonBean.

          Suppose we would do a 'failover' over call from GreeterBean on node A to PersonBean on node B. During that call either node dies. Effectively the whole request is no bogus.

           

          Alternatively we could configure the clustering to do load balancing and we do a 'load balance' call from GreeterBean on node A to PersonBean on node B. This would add overhead on the cluster itself and increase load on node B. Subsequently a call will go from node B to node A. Again more overhead. Soon you'll find your cluster only doing load-balancing overhead and nothing more.

           

          Thus whenever a node receives a call from the outside world it should do its utmost to process it by itself.