Re: Why is JNDI so slow by nature

Niclas Hedhman <[email protected]> Wed, 27 May 2009 11:16:53 +0800
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
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 =A0and t=
he
> 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 {
>
> =A0 =A0public static void login() throws Exception {
> =A0 =A0 =A0 =A0 printTime("Start application: ");
>
> =A0 =A0 =A0 =A0Properties env =3D new Properties();
> =A0 =A0 =A0 =A0env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> "org.jnp.interfaces.NamingContextFactory");
>
> =A0 =A0 =A0 =A0// Your server here. =A0in your case will be: serverURL
> =A0 =A0 =A0 =A0env.setProperty(Context.PROVIDER_URL, "jnp://localhost:109=
9/");
>
>
> =A0 =A0 =A0 =A0printTime("InitialContext start");
>
> =A0 =A0 =A0 =A0InitialContext context =3D new InitialContext(env);
>
> =A0 =A0 =A0 =A0printTime("InitialContext stop");
>
>
>
> =A0 =A0 =A0 =A0printTime("Lookup start");
>
> =A0 =A0 =A0 =A0ILoader loader=3D (ILoader)context.lookup("Platform/remote=
");
>
> =A0 =A0 =A0 =A0printTime("Lookup stop");
>
>
>
> =A0 =A0}
>
> =A0 =A0public static void main(String[] args) throws Exception {
> =A0 =A0 =A0 =A0ClientLoginDemo.login();
>
>
> =A0 =A0}
>
> }
>
>
>
> On Fri, May 22, 2009 at 12:09 PM, Gregg Wonderly <[email protected]> wro=
te:
>
> Distributed Garbage Collection (DGC) can often play a part in these delay=
s
> 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 c=
all
> chain things are at when these delays occur. =A0That should give you a lo=
t
> 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 secon=
d.
>
> The Context is configured like this:
>
> Hashtable<String, String> env =3D 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 =3D (ILoader) ctx.lookup("Platform/remote");
>
>
> Is JDNI slow by nature, or is it a configurable thing? Can jboss play a p=
art
> in this role?
>
>
> Hope this is the correct place to ask for help. :)
>
> Best regards,
> Alex
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> To unsubscribe, send email to [email protected] and include in the bo=
dy
> of the message "signoff RMI-USERS". =A0For 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
>
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> To unsubscribe, send email to [email protected] and include in the bo=
dy
> of the message "signoff RMI-USERS". =A0For 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
>
>
>
>
>
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> To unsubscribe, send email to [email protected] and include in the bo=
dy
> of the message "signoff RMI-USERS". =A0For 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
>



--=20
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

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
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