4 Replies Latest reply on May 12, 2007 5:34 PM by Brian Stansberry

    Doubt regarding clinet side interceptor.....

    Deiveehan Newbie

      The jboss site says that there are 2 types of Clustering architectures
      a. Load balancing and
      b. Client side interceptors
      I have tried out load balancing using Apache with mod_jk and it works fine.

      What are exactly client side interceptors ? I hope this is simply clustering services like EJB.,
      Is there anything apart from what I have understood.

      If I cluster my EJBs, can I say that we have implemented Client side interceptors. I am a bit confused becoz, different people use different terms.

      can I implement both load balancing and client side interceptor or we can only use any one of the clustering types.

      I hope load balancing is just meant if the users of your application is very huge and it simply redirects the http request to different servers. For actual clustering, we need to cluster the EJBs.

      In my project JNDI services and EJB are used and is it required to implement JNDI type clustering as well as EJB clustering.

      Reference: http://docs.jboss.org/jbossas/jboss4guide/r4/html/cluster.chapt.html

        • 1. Re: Doubt regarding clinet side interceptor.....
          Brian Stansberry Master

          First, client-side interceptors are basically not relevant to an HTTP client talking to the cluster (e.g. a normal webapp where the client is a browser).

          Cluster-aware client side interceptors are involved when a Java client contacts a server in the cluster and downloads proxy, which it then uses to invoke operations on servers in the cluster. E.g.:

          1) Create an InitialContext configured to use HA-JNDI on port 1100. This results in a communication to the HA-JNDI service on 1100 and the download of a cluster-aware naming service proxy. This is all transparent to your code. When you then do lookups using that context, the proxy includes interceptors that handle load balancing and failover of the naming lookups.

          2) Contact JNDI or HA-JNDI (doesn't matter which) and look up an EJB that's configured as clustered. You get an EJB proxy that includes a cluster-aware interceptor. When you make invocations on the bean, the interceptor handles load balancing and failover.

          • 2. Re: Doubt regarding clinet side interceptor.....
            Deiveehan Newbie

            Thanks Brian,

            I have a situation where the entire application is bundled within a single ear (the web and the ejb layer are part of the single ear) and deployed in Jboss.

            Now since the no. of users has increased and due to performance issues, we have put 3 instances of jboss machines running with these ears. We are currently having another machine with Apache with mod_jk for load balancing and it works good.

            Now,
            1. Is it advisable to do ejb clustering (in addition to load balancing) here. (Because the web and the business layer are not clearly separated i.e., everthing is part of a single ear).

            2. If its possible to do ejb clustering in this type of situation, will the performance be increased in any way, since I hope simply increasing the no. of beans in the stateless session bean would suffice in this situation.

            • 3. Re: Doubt regarding clinet side interceptor.....
              Cheenu M Newbie

              I think you have a conceptual misunderstanding here.

              - Clustering is done for fault tolerance (aka high availability) of an application.
              - Load balancing is to distribute load, and hence for scalability.

              Clustering any object (incl. HTTPSession, Stateful EJB ...) comes at a price, because the state has to be replicated to other members(nodes) of the cluster.

              So, if scalability is your problem clustering will not help.
              Apart from increasing number of instances, you need to determine bottleneck, and tune.
              Some potential areas are:
              - Web tier (mod_jk to jboss-web connection)
              - DataSource Connection Pool
              - Entity load (fetch policy, eager/lazy reads etc.)
              - Java VM (garbage collection, optimal heapsize etc.)

              Cheenu

              • 4. Re: Doubt regarding clinet side interceptor.....
                Brian Stansberry Master

                If your EJB tier consists of SLSBs that are only invoked from the web tier, don't make them clustered, and don't use HA-JNDI to look them up from the web tier. JBoss is going to detect that the EJB is available in the same VM as the web tier and is going to send any call to the EJB in the same VM, which in almost all cases is the most performant solution.

                If you have SFSBs, then whether to cluster them or not depends on whether you need the fault tolerance that replicating them provides. So, as cheenu2 said, you would cluster them for fault tolerance, not scalability. Clustering SFSBs carries a performance cost.

                For entities, if you are caching entities beyond the life of a transaction, then you need to think about keeping the caches consistent across the cluster via cache invalidation (EJB2) or replication (EJB3).