3 Replies Latest reply on Jan 7, 2003 3:18 AM by Sacha Labourey

    Round Robin with SLSB doesn't work for me

    Paul Smith Newbie

      Okay, I've done a LOT of searching on this topic, but nothing seems to be different from what I am doing.

      Scenario:

      2 x JBoss servers (3.0.4), JDK 1.4.0 , one running on my local dev machine, another on another simple desktop

      Deployed an EAR with two jars:
      * EventFactory.jar (SLSB with a simple doSomething() method that just logs)
      * SimpleMsgConsumer.jar (an MDB that receives a message and calls the EventFactory's doSomething() method)

      * Have ensured that the EventFactory jboss.xml is setup to be marked as clustered. (leaving default Round Robin policy as per Clustering docs in place, also tried explicitly setting it to no avail)

      * There are NO local interfaces in the SLSB so it shouldn't sneakily try and use that for performance reasons.

      The MDB is configured during initialization to do a lookup the SLSB using the HA-JNDI as follows (as per Clustering docs):
      ....
      Properties p = new Properties();
      p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
      p.put(Context.PROVIDER_URL, "localhost:1100");
      InitialContext ctx = new InitialContext(p);
      Object o = ctx.lookup("EventFactorySessionBean");
      EventFactorySessionHome home = (EventFactorySessionHome)o;
      logger4j.info("Created remote interface");
      sessionBean = home.create();
      ...

      Once this home/remote interfaces have been looked up using HA-JNDI and the reference stored in the MDB, it is my understanding that when the MDB receives a message it can use the SLSB remote interface to call the doSomething() method and have those requests load balanced amongst the cluster. I've never managed to get it to work, as it always uses the local machine where the JMS queue is receiving the messages.

      Please, any help would be appreciated, it's driving me a little barmy.

        • 1. Re: Round Robin with SLSB doesn't work for me
          Sacha Labourey Master

          Hello Paul,

          Your assumptions were almost correct. You forgot a very smiple design-decision that we made: everytime we can do in-VM call, we favor it and do not do remote invocations (optimisations). Consequently, as long as your SLSB is also deployed in the same JVM as your MDB, it will never round-robin. A flag will be present in future JBoss release (4.0 at least) to bypass this optimisation.

          In the meantime, you can deploy two jboss instances on the same machine: one simply running the MDB and the other your applications with the SLSB.

          Cheers,



          sacha

          • 2. Re: Round Robin with SLSB doesn't work for me
            Paul Smith Newbie

            ooooh, thank you sooo much for that tid-bit. It actually makes a lot of logical performance sense, I was just wondering how one might do this approach. Late yesterday I verified Round Robin behaviour using a SEPARATE simple JNDI client (i.e not a Session/Entity/Message bean) which was of course outside the JBoss VM.

            I've actually ALMOST got it to work by having the SLSB hosted on 2 nodes of a cluster, and having the MDB hosted on the 3rd, but having a "TransactionImpl not serializable" error, but think that is a mistake in the SLSB descriptor (no need for a transaction in this instance).

            Your description of having separate JBoss VM's, one for the JMS, and one for the clustered beans is actually an incredibly simpler idea, can't believe I didn't try that.

            Any idea when Clustering a JMS queue and MDB might be on the cards?

            • 3. Re: Round Robin with SLSB doesn't work for me
              Sacha Labourey Master

              It is definitively on the todo list for 4.0. Furthermore, FYI load-balancing policies are "better" implemented (state shared accross the same proxies of a VM) in 3.2 so you may give it a try: 3.2.0RC1 should go out on Sunday.

              Cheers,


              sacha