I try to get one username item on LDAP server, but my client code will spent 0.6s, it is too slow, I don't know why. but the 'ldapsearch' and 'LDAP Admin' is too fast, so I think the problem is not from the LDAP server, does anyone can give me some clue, why my code is slow? Thanks!:)
int main(int argc, char *argv[])
{
        LDAP  *ld;
        char  *dn;
        int   version, rc;
        const char *root_dn = "cn=ldapadm,dc=extreme3,dc=com";
        char *root_pass = "Password123!";
        printf("Connecting %s in port %d...\n\n", HOSTNAME, PORTNUMBER);
        rc = ldap_initialize(&ld, HOSTNAME);
        if ( rc != LDAP_SUCCESS )
        {
            printf("Error !");
        }
        version = LDAP_VERSION3;
        ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version);
        printf("Bind!\n");
        rc = ldap_simple_bind_s(ld, root_dn, root_pass);
        if (rc != LDAP_SUCCESS) {
            fprintf(stderr, "Error: %s\n", ldap_err2string(rc));
            return (1);
        }
        LDAPMessage* res = nullptr;
        ldap_search_s(ld, "dc=extreme3,dc=com", LDAP_SCOPE_SUBTREE, "(uid=ncvm9141196u1432)", 0, 0, &res);    //slow at here
        int count = ldap_count_entries(ld, res);
        printf("Result: %d S:\n", count);
        ldap_unbind(ld);
        return(0);
  }
////////////////////////////////
c4dev@sles15-guol13-dev-00:/c4_working/code> time ./prog
Connecting ldap://10.109.14.51 in port 389...
Bind!
Result: 1 
real    0m0.626s
user    0m0.027s
sys     0m0.000s
