4 Replies Latest reply on May 27, 2004 5:54 AM by Satish Singaram

    Jboss server fails with 20 concurrent hits - service unavail

    rraam75 Newbie

      Hello All,
      I wrote a thread application(pure java code) as a client and from that i try to lookup a stateless session bean and create a remote object.Nothing more businees logic is involved in that..but while i run my thread application my program fails with SERVICE UNAVAILABLE EXCEPTION after 10 concurrent lookup's.

      Below is the error content,

      18:38:48,845 WARN [NamingContext] Failed to connect to 127.0.0.1:1099
      javax.naming.CommunicationException: Failed to connect to server 127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server 127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:215)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1181)


      here is my code where i create a object and start the thread

      public void generateLoad(int threads) {
      for (int i = 0; i < threads; i++)
      new ThroughputTest(i).start();
      }



      Below code is my run method,

      public void run() {
      Context ctx = null;
      Hashtable ht = new Hashtable();
      ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
      ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
      try {
      ctx = new InitialContext(ht);
      clusterEmpSLSessionHome = ( ClusterEmpSLSessionHome) javax.rmi .PortableRemoteObject.narrow( ctx.lookup("ClusterEmpSLSessionBean"), ClusterEmpSLSessionHome.class);
      ClusterEmpSLSession clusterEmpSLSession = clusterEmpSLSessionHome.create();
      return 0;
      } catch (Exception e) {
      e.printStackTrace();
      return -1;
      } finally {
      try {
      ctx.close();
      } catch (Exception e) { }

      }



      From the above code i was not able to lookup more than 20..Any one can help me to resolve this problem...iam sure that there is some configuration setting to solve this issue.
      Advanvce thanks to you all..



        • 1. Re: Jboss server fails with 20 concurrent hits - service una
          Sacha Labourey Master

          you simply need to augment the backlog of the JNP service so it can queue enough requests.

          sacha

          • 2. Re: Jboss server fails with 20 concurrent hits - service una
            rraam75 Newbie

            hi,
            thanx Sacha

            I changed the backlog value from 50 to 500 & 5000..but still i face the same exception...

            In the above mail in the run() mtd i wrongly given the code that belongs to weblogic server...however there is not much change except the setting of env properties...

            Below is the correct version of code at run() mtd..

            public int callJBossHome() {
            try {
            Properties env = new Properties();
            InitialContext initialContext = null;
            env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
            env.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
            env.put(Context.BATCHSIZE,"1000");
            initialContext = new InitialContext(env);
            try {
            clusterEmpSLSessionHome = (ClusterEmpSLSessionHome) javax.rmi.PortableRemoteObject.narrow( initialContext.lookup("ClusterEmpSLSessionBean"),
            ClusterEmpSLSessionHome.class);
            }catch (Exception e1){
            System.out.println("Exception at LOOKUP is"); e1.printStackTrace();
            }
            ClusterEmpSLSession clusterEmpSLSession = clusterEmpSLSessionHome.create();
            return 0;
            } catch (Exception e) {
            System.out.println("Exception while creating remote obj is:");
            e.printStackTrace();
            return -1;
            }
            }


            do u have any other options to solve this problem...I tried to do the same thing with weblogic server..there i can make 5000 concurreny hits or lookups...


            In addition to that can anyone explain me about the env properties,

            env.put(Context.BATCHSIZE,"1000");

            thanx

            • 3. Re: Jboss server fails with 20 concurrent hits - service una
              rajsgarage Newbie

              I carried out the test as rram75 had suggested and ended up getting timed out exception with jboss.

              I also tried hitting weblogic server with the same code and it did work perfectly fine. One thing i did try was to print the thread name to see, whether in case the call to the server was synchronized and i was right. Web logic did synchronize the calls to the naming server.

              I debugged the jboss naming client code and modified the static Naming getServer(String host, int port, Hashtable serverEnv) throws NamingException code to be synchronized and that took care of the socket timeout exception that was happening before. THe reason for the socket exception was that at times, the Naming reference was null and it then tried to do a multicasting to find the server. This was the place where a socket time out happened.

              I did a few testing and benchmarking with weblogic against jboss and found that jboss was faster with smaller amounts of hits to the server. ie, if i had 100 threads that hits the server using jndi , jboss would always beat weblogic in retrieving the objects. But for higher threshold values, weblogic beats jboss. This is probably due to the way it attempts reconnection in lookup function of org.jnp.Interfaces.NamingContext .java file. Augmenting the backlog also didnt help jboss in significantly reducing the time in retrieving objects using Jndi.

              I am wondering if i had to do any thing else to make the jndi lookup faster?.
              Regards,
              Rajaneesh, Technologist
              Vistasoft India