LDAP query from Java is slow -
we having performance issues our ldap , out java server. whenever call our ldap query, looks (&(objectclass=person)(department=0128)(departmentnumber=1)) takes 2000 milliseconds, slow us.
however if perform search, using same query standard ldap browser (eg. ldap admin program web), takes few milliseconds.
our simplified code below :
public static void main(string[] args) throws namingexception { hashtable<string, string> env = new hashtable<string, string>(); // nopmd env.put(context.provider_url, "ldap://abc123.muc:389"); env.put(context.security_principal, "cn=myproject,ou=projectusers,dc=com"); env.put(context.security_credentials, "asdf"); env.put(context.initial_context_factory, "com.sun.jndi.ldap.ldapctxfactory"); env.put(context.security_authentication, "simple"); ldapcontext ileanldapctx = new initialldapcontext(env, null); //time create context = 40ms string filter = "(&(objectclass=person)(department=0128)(departmentnumber=1))"; namingenumeration<searchresult> results = ileanldapctx.search("o=computers,dc=com", filter, null); //time search filter = 2000ms namingenumeration<searchresult> results2 = ileanldapctx.search("o=computers,dc=com", filter, null); //2nd time search filter = 2000ms }
is there initialisation problem going on here?
i thought instantiating ldapcontext should have solved time intensive stuff. ldapctx.search takes 2 seconds, , if call again, still 2 seconds. initial search not seem initialisation. , if query slow, why other ldap browser have go fast?
Comments
Post a Comment