I’ve been using Exldap to integrate my application with an Active Directory server. For some functions not supported by Exldap
, I’ve been calling :eldap
functions directly. I encountered a huge performance issue today and I’m trying to figure out what’s going on. In order to narrow the issue down, I bypassed Exldap
and did everything directly using :eldap
.
All I’m trying to do is list all the members of a largish group (~380 members). When I execute the search using the ldapsearch
command line utility, I get all the results displayed in a fraction of a second:
$ time ldapsearch \
-H ldaps:/ldap.example.edu:636 \
-D 'CN=My Bind DN,OU=Service Accounts,DC=department,DC=example,DC=edu' \
-w 'bind_password' \
-b 'DC=department,DC=example,DC=edu' \
-s sub \
'(memberOf=CN=Staff,OU=Staff,DC=department,DC=example,DC=edu)'
# [379 responses / ~25000 lines of output omitted]
# numResponses: 379
# numEntries: 377
# numReferences: 1
0.05s user 0.05s system 25% cpu 0.407 total
When I execute the exact same search using the exact same parameters using :eldap
:
{:ok, conn} = :eldap.open(['ldap.example.edu'], port: 636, timeout: 50000, ssl: true)
:eldap.simple_bind(
conn,
'CN=My Bind DN,OU=Service Accounts,DC=department,DC=example,DC=edu',
'bind_password'
)
base = 'DC=department,DC=example,DC=edu'
scope = :eldap.wholeSubtree()
filter = :eldap.equalityMatch('memberOf', 'CN=Staff,OU=Staff,DC=department,DC=example,DC=edu')
:eldap.search(conn, base: base, scope: scope, filter: filter)
# 50 seconds pass
{:error, {:gen_tcp_error, :timeout}}
I can’t spy on the whole conversation over the wire because it’s using SSL, but I can tell that the ldapsearch
version results in about a 676k payload while the :eldap
version only pulls down 323k before communication stops and the search (eventually) times out. I’m going to set up a local LDAP server in a Docker container without SSL and see how it fares.
Other searches are working fine; it’s just timing out on the one with a few hundred results. I’m not sure where to go from here. Any help or insight would be greatly appreciated.