Hi Graham,

I'm trying to bring a large Perl application out of the dark ages and as
part of this need to migrate from the existing Perl LDAP module (Ldapp -
based on Ldapc) to Net::LDAP.

What I've found though is that the performance of Net::LDAP is around
seven times worse than the old solution - but I couldn't find any
references on Google about other people experiencing performance problems
with Net::LDAP - so I assumed the problem was at my end.

I decided to investigate further and profiled a script that obtained all
the LDAP attributes for a specific userid 500 times. Here's the profiler
output:

$ dprofpp tmon.out
Total Elapsed Time = 27.01739 Seconds
  User+System Time = 20.43654 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
 27.7   5.668 55.339  13503   0.0004 0.0041  Convert::ASN1::_decode
 24.6   5.046  4.818  29009   0.0002 0.0002  Convert::ASN1::_decode_tl
6.94 1.418 44.101 12502 0.0001 0.0035 Convert::ASN1::_dec_sequence
 5.73   1.172 11.030   4505   0.0003 0.0024  Convert::ASN1::_encode
 5.23   1.069  0.962  13502   0.0001 0.0001  Convert::ASN1::_dec_string
 3.62   0.739  1.647     38   0.0194 0.0433  ResearchUtils::BEGIN
2.83 0.578 6.301 3002 0.0002 0.0021 Convert::ASN1::_enc_sequence
 2.69   0.550  0.542   1001   0.0005 0.0005  Convert::ASN1::asn_read
2.50 0.510 0.410 10506 0.0000 0.0000 Convert::ASN1::asn_encode_length
 2.24   0.457 14.619   1001   0.0005 0.0146  Net::LDAP::_recvresp
2.03 0.414 19.719 500 0.0008 0.0394 ResearchLDAP::getAttributes 1.71 0.350 0.382 5000 0.0001 0.0001 Net::LDAP::Entry::get_value 1.61 0.330 0.318 1502 0.0002 0.0002 Convert::ASN1::_dec_integer
 1.56   0.319 12.762   1001   0.0003 0.0127  Convert::ASN1::decode
1.38 0.282 0.334 1 0.2822 0.3336 Convert::ASN1::parser::yyparse

Convert::ASN1 - or at least the way Net::LDAP uses Convert::ASN1 seems to
be the "problem".


I should take a brief minute to explain why this is an issue for me. When
doing a single lookup (e.g. when a user hits a website) the performance
difference can be ignored as 7 multiplied by a very small number is still
very small. But when my system needs to send a mail to 10,000+ users it
needs to lookup 10,000 LDAP entries and so there would be a delay of
several minutes which my business users would not be very happy about.

I appreciate that if Net::LDAP performs for your personal use cases then
you may not want to look at this issue, but I do have to ask - is there
anything that you (or I - am happy to write a patch etc.) can do to
resolve this problem?

Mozilla::LDAP is based on Ldapc I believe, so I guess I could use that,
but it's just not as 'cool' or powerful as your module. I'd also imagine
it's less well supported/understood by the wider Perl community.

So, to Net::LDAP or not Net::LDAP? that is my question.

I do appreciate you taking the time to read my email, hopefully you will
also be able to spare some time to respond.

Regards

Sagar Shah
(cpanid: SRSHAH)



Reply via email to