For Programmers: Free Programming Magazines  


Home > Archive > LDAP > June 2007 > LDAP read?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author LDAP read?
Lars Skjærlund

2007-03-05, 4:32 am

Hi list,

I've started creating an application that runs against a larger Novell
eDir system.

Unfortunately, I have huge performance problems :-(.

Basically, here's what I want to do (in pseudocode):

@entries = LDAP->Search(Projects)

foreach my $entry (@entries) {
LDAP->Search($entry->{Project_Manager})
...
}

In this case, the object could be to find the full name of each project
manager.

Unfortunately, this code is extremely slow when run against a directory
with several thousand projects - responsetime is measured in lots of
minutes.

Why isn't there an LDAP->Read function? I have the DN name of the
object in question and need not search for it.

As it appears I cannot read it directly, how do I get the attributes of
an object when I know the DN - in the most efficient way?

Regards,
Lars
--

Lars Skjærlund
Consultant

Ubiquitech A/S
Lyngby Hovedgade 4,3
2800 Kgs. Lyngby
Denmark

Tel: +4570200084
Mobile: +4523457157

http://www.ubiquitech.com

Chris Ridd

2007-03-05, 8:23 am

On 5/3/07 9:59, "Lars Skj=E6rlund" <ls@ubiquitech.com> wrote:

> Hi list,
>=20
> I've started creating an application that runs against a larger Novell
> eDir system.
>=20
> Unfortunately, I have huge performance problems :-(.
>=20
> Basically, here's what I want to do (in pseudocode):
>=20
> @entries =3D LDAP->Search(Projects)
>=20
> foreach my $entry (@entries) {
> LDAP->Search($entry->{Project_Manager})
> ...
> }
>=20
> In this case, the object could be to find the full name of each project
> manager.
>=20
> Unfortunately, this code is extremely slow when run against a directory
> with several thousand projects - responsetime is measured in lots of
> minutes.


Are your searches synchronous, or can you fire them all off in parallel?

> Why isn't there an LDAP->Read function? I have the DN name of the
> object in question and need not search for it.


LDAP does not provide a read operation in the protocol; you always have to
simulate it with a base object search using the DN you know.

> As it appears I cannot read it directly, how do I get the attributes of
> an object when I know the DN - in the most efficient way?


$ldap->search(base =3D> "the DN you know",
scope =3D> 'base',
filter =3D> '(objectclass=3D*)');

Cheers,

Chris


Graham Barr

2007-03-05, 8:23 am

On Mar 5, 2007, at 3:59 AM, Lars Skj=E6rlund wrote:
> Unfortunately, I have huge performance problems :-(.
>
> Basically, here's what I want to do (in pseudocode):


A little more detail in the code might help us help you. While =20
Net::LDAP has some performance hit for doing everything in perl. I =20
suspect in your case the main issue is the network overhead.

> @entries =3D LDAP->Search(Projects)


How many attributes does a project entry have? Do you only ask for =20
the attributes you need?

If, there are many projects, it will probably be worth using a =20
callback here so you can fire
off the other searches as you get your entries back.

> foreach my $entry (@entries) {
> LDAP->Search($entry->{Project_Manager})
> ...
> }


Let me try and give an outline as to how to put these in parallel.

$ldap->async(0);
$result =3D $ldap->search(
@project_search_args,
attrs =3D> [qw(attrs needed to fetch manager)],
callback =3D> \&get_project_manager
);
$ldap->sync;
$ldap->async(1);

sub get_project_manager {
my ($mesg, $entry) =3D @_;

return unless $entry; # We are done

if ($entry->isa('Net::LDAP::Entry')) {
$mesg->shift_entry;
my $managerDN =3D $entry->get_value(Project_Manager);
$mesg->parent->search(
@manager_search_args,
attrs =3D> [qw(attrs needed)],
callback =3D> sub { process_manager($entry, @_) }, # must pass =20=

project first as @_ is variable length
);
}

if ($entry->isa('Net::LDAP::Reference')) {
# Handle references
}
}

sub process_manager {
my ($project, $mesg, $entry) =3D @_;

return unless $entry; # We are done, probably should check $mesg-=20
>code


if ($entry->isa('Net::LDAP::Entry')) {
....
}

if ($entry->isa('Net::LDAP::Reference')) {
# Handle references
}
}

Graham.

Lars Skjærlund

2007-03-06, 4:40 am

Hi Graham,

> A little more detail in the code might help us help you. While
> Net::LDAP has some performance hit for doing everything in perl. I
> suspect in your case the main issue is the network overhead.


I value your input a lot - thanks.

Unfortunately, I have a very tight deadline to work against right now,
so I'll try out some of your suggestions at a later time and come back
then.

Regards,
Lars
--

Lars Skjærlund
Consultant

Ubiquitech A/S
Lyngby Hovedgade 4,3
2800 Kgs. Lyngby
Denmark

Tel: +4570200084
Mobile: +4523457157

http://www.ubiquitech.com

Timbitz

2007-03-31, 1:08 am

Catherine Zeta Jone Throatjob!
http://Catherine-Zeta-Jone-Throatjo...hp?movie=148803
Rachelle

2007-04-11, 8:14 am

Katie Holmes touching her boobs!
http://Katie-Holmes-touching-her-bo...hp?movie=148803
Poder

2007-04-19, 4:40 am

http://Martha-Stewart-anal-action.o...hp?movie=148803
Dicktentard

2007-04-21, 4:27 am

Pamela Anderson in nylons!
http://Pamela-Anderson-in-nylons.in...hp?movie=148803
Kingoftheswing

2007-04-29, 9:30 pm

A nice video about 2 crazy grandmas.
http://amazing-matures.info/video218571/
Dape0

2007-05-25, 4:39 am

Hardcore sex movie! Free download!
http://www.incredible-asians-online...dicked_hard.avi
Aids

2007-06-12, 12:21 am

Jennifer Aniston and Britney Spears , Satisfying Her Lesbian Girlfriend!
http://www.reyrewh.com/MediaPlayer.asp?q=726648

Jennifer Aniston and Laetitia Casta , Petting Slits!
http://www.reyrewh.com/player?id=726648

Nikki Cox and Jennifer Aniston Lick Pussies On Sofa!
http://www.reyrewh.com/Player.php?id=726648

Christina Aguilera and Jessica Simpson , Movies Of Crucified Lesbian Slave!
http://www.reyrewh.com/watch?movie=726648

Paula Abdul and Helen Hunt Tongue Tickles Lesbian Lovers Pussy Movies!
http://www.reyrewh.com/Player.php?movie=726648
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com