Re: Why is JNDI so slow by nature

Gregg Wonderly <[email protected]> Tue, 26 May 2009 22:38:44 -0500
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
I have seen this happen as well.  I really believe that if he can get  
stack traces from the client JVMs that he'll know exactly what the  
problem is.

Gregg Wonderly

On May 26, 2009, at 10:16 PM, Niclas Hedhman wrote:

> I would suspect that you are on a Windows network that is not happy
> with DNS. This used to be a huge problem for me in the past. Related
> to how Windows resolved computer names, first going through some WINS
> resolver, and not hitting the DNS until after WINS timed out. Turning
> WINS off and running on "DNS-only" networks was a solution I recall
> worked.
>
> Cheers
> Niclas
>
> On Wed, May 27, 2009 at 12:30 AM, Aleksander Bai <[email protected]>  
> wrote:
>> Hi,
>>
>>
>>
>> And thanks for answering.
>>
>> Results when connection to server1 and server2 (both outside the  
>> local
>> network):
>>
>>
>>
>> Start: 0
>>
>> InitialContext : 0,049
>>
>> Lookup: 6,972
>>
>>
>>
>> Results when connection to localhost:
>>
>>
>>
>> Start: 0
>>
>> InitialContext : 0,083
>>
>> Lookup: 0,316
>>
>>
>>
>> Pinging server1 and server2 takes about 19-20ms.
>>
>>
>>
>> Any ideas or anything else I can test?
>>
>>
>>
>> Alex
>>
>>
>>
>>
>>
>> From: John Cohen [mailto:[email protected]]
>> Sent: 26. mai 2009 17:58
>> To: [email protected]
>> Subject: Fwd: Why is JNDI so slow by nature
>>
>>
>>
>>
>>
>> ---------- Forwarded message ----------
>> From: John Cohen <[email protected]>
>> Date: Tue, May 26, 2009 at 11:55 AM
>> Subject: Re: Why is JNDI so slow by nature
>> To: Gregg Wonderly <[email protected]>
>>
>>
>> Hey, your email is not clear to me.
>> You mentioned that you tested with different Application Servers   
>> and the
>> server connection was not the problem...
>>
>> Can you run the below code using different application servers and  
>> let me
>> know the output.
>>
>>
>> import javax.naming.Context;
>> import javax.naming.InitialContext;
>> import java.util.Collection;
>> import java.util.Properties;
>>
>> public class ClientLoginDemo {
>>
>>    public static void login() throws Exception {
>>         printTime("Start application: ");
>>
>>        Properties env = new Properties();
>>        env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
>> "org.jnp.interfaces.NamingContextFactory");
>>
>>        // Your server here.  in your case will be: serverURL
>>        env.setProperty(Context.PROVIDER_URL, "jnp://localhost: 
>> 1099/");
>>
>>
>>        printTime("InitialContext start");
>>
>>        InitialContext context = new InitialContext(env);
>>
>>        printTime("InitialContext stop");
>>
>>
>>
>>        printTime("Lookup start");
>>
>>        ILoader loader= (ILoader)context.lookup("Platform/remote");
>>
>>        printTime("Lookup stop");
>>
>>
>>
>>    }
>>
>>    public static void main(String[] args) throws Exception {
>>        ClientLoginDemo.login();
>>
>>
>>    }
>>
>> }
>>
>>
>>
>> On Fri, May 22, 2009 at 12:09 PM, Gregg Wonderly  
>> <[email protected]> wrote:
>>
>> Distributed Garbage Collection (DGC) can often play a part in these  
>> delays
>> by creating additional calls to the remote VM to check on liveness  
>> of the
>> object. If you can, I'd suggest using stack dumps to asses where in  
>> the call
>> chain things are at when these delays occur.  That should give you  
>> a lot
>> more information about what is actually going on.
>>
>> Gregg Wonderly
>>
>>
>>
>> Aleksander Bai wrote:
>>
>> Hi,
>>
>> We have an environment with Jboss (running ejbs) and a standalone
>> application.
>>
>> To connect we use JNDI, but it's quite slow (averaging around 7  
>> seconds, but
>> depending on the connection site's internet speed it can be as long  
>> as 30
>> seconds). This does not happen running the (jboss) server localhost
>> (obviously).
>> We've tried with several servers. There isn't a problem with the  
>> server
>> connections, because both apache and ssh connects under less than a  
>> second.
>>
>> The Context is configured like this:
>>
>> Hashtable<String, String> env = new Hashtable<String, String>();
>> env.put(InitialContext.INITIAL_CONTEXT_FACTORY,
>> "org.jnp.interfaces.NamingContextFactory");
>> env.put(InitialContext.URL_PKG_PREFIXES,
>> "org.jboss.naming:org.jnp.interfaces");
>> env.put(InitialContext.PROVIDER_URL, serverURL);
>> env.put("jnp.timeout", "10000");
>> env.put("jnp.sotimeout", "5000");
>>
>> final ILoader platformLoader = (ILoader) ctx.lookup("Platform/ 
>> remote");
>>
>>
>> Is JDNI slow by nature, or is it a configurable thing? Can jboss  
>> play a part
>> in this role?
>>
>>
>> Hope this is the correct place to ask for help. :)
>>
>> Best regards,
>> Alex
>>
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> To unsubscribe, send email to [email protected] and include in  
>> the body
>> of the message "signoff RMI-USERS".  For general help, send email to
>> [email protected] and include in the body of the message "help".
>>
>> For a list of frequently asked RMI questions please refer to:
>> http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html
>>
>> To view past RMI-USERS postings, please see:
>> http://archives.java.sun.com/archives/rmi-users.html
>>
>>
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> To unsubscribe, send email to [email protected] and include in  
>> the body
>> of the message "signoff RMI-USERS".  For general help, send email to
>> [email protected] and include in the body of the message "help".
>>
>> For a list of frequently asked RMI questions please refer to:
>> http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html
>>
>> To view past RMI-USERS postings, please see:
>> http://archives.java.sun.com/archives/rmi-users.html
>>
>>
>>
>>
>>
>>
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> To unsubscribe, send email to [email protected] and include in  
>> the body
>> of the message "signoff RMI-USERS".  For general help, send email to
>> [email protected] and include in the body of the message "help".
>>
>> For a list of frequently asked RMI questions please refer to:
>> http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html
>>
>> To view past RMI-USERS postings, please see:
>> http://archives.java.sun.com/archives/rmi-users.html
>>
>
>
>
> -- 
> Niclas Hedhman, Software Developer
> http://www.qi4j.org - New Energy for Java
>
> I  live here; http://tinyurl.com/2qq9er
> I  work here; http://tinyurl.com/2ymelc
> I relax here; http://tinyurl.com/2cgsug
>
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> To unsubscribe, send email to [email protected] and include in  
> the body
> of the message "signoff RMI-USERS".  For general help, send email to
> [email protected] and include in the body of the message "help".
>
> For a list of frequently asked RMI questions please refer to:
> http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html
>
> To view past RMI-USERS postings, please see:
> http://archives.java.sun.com/archives/rmi-users.html

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html