1 Reply Latest reply on May 18, 2007 8:29 PM by Elias Ross

    Jndi lookup performance

    Lee Minh Newbie

      Hi everyone,
      I have done a simple test on jndi lookup (on a separated client). I just really upset that the average time for the lookup is around 400 ms (local machine) and 500ms (remote machine).
      I just wonder is there something wrong with my performance optimization ?

      Following is the code of the client

      public static void main(String[] args) {
       // TODO Auto-generated method stub
      
       if (System.getSecurityManager() == null)
       System.setSecurityManager(new RMISecurityManager());
       Calendar c = Calendar.getInstance();
      
       Properties env = new Properties();
       env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       //switch to 'localhost:1100' for performance comparison
       env.setProperty("java.naming.provider.url", "192.168.1.2:1099");
       env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
       try{
       long start = System.currentTimeMillis();
       Context ctx = new InitialContext(env);
       Object ref = ctx.lookup("BBean/remote");
      
      
       long end = System.currentTimeMillis();
       long el = end - start;
       System.out.println("elapse(ms): " + el);
       }
       catch(NamingException e){
       e.printStackTrace();
       }
       }


      Thank you a lot and regards
      Boehm