[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: OpenLDAP performance vs. PostgreSQL



John Madden wrote:
> On Wednesday 15 March 2006 10:17, Howard Chu wrote:
> 
>>Also, assuming that you rule out the overhead of script
>>interpretation/execution, you haven't said anything about whether you
>>bothered to configure back-bdb with appropriate cache settings etc.
> 
> 
> FWIW, I suspect this is his issue.  I use both DBD::Pg and Net::LDAP 
> extensively and I have very good metrics from both of them.  But in a tree of 
> 20,000 objects, he should easily be able to pull 15k queries/sec on decent 
> hardware out of OpenLDAP and I suspect PostgreSQL (or any other RDBMS) 
> couldn't come close.  

Hmm... I've been trying different variations without any significant
difference in LDAP performance. FWIW the test are being done on a 1.4GHz
centrino laptop... so there is a HD bottleneck and I don't have a
separate drive to store log-files. However, I'm not trying to test _how_
fast OpenLDAP is... just to find out how it compares to PostgreSQL for
storing many simple objects. (system is Debian Sarge)

The DB_CONFIG containts:
=============================
set_cachesize   0       52428800        0
set_lg_regionmax        1048576
set_lg_max              10485760
set_lg_bsize            2097152
set_lk_max_objects      5000
set_lk_max_locks        5000
set_lk_max_lockers      5000


The slapd.conf has (apart from acls and module load):
=============================
schemacheck     on
database        bdb

# The base of your directory in database #1
suffix          "dc=nodomain"

# Indexing options for database #1
index           objectClass eq
index  cn eq


The Schema is
=============================
attributetype ( 1.3.6.1.4.1.10664.2.1
              NAME 'pif'
              DESC 'et tal'
              EQUALITY integerMatch
              SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )

objectclass ( 1.3.6.1.4.1.10664.1.1
            NAME 'pifpafpuf' DESC 'test object'
            SUP top
            STRUCTURAL
            MUST ( cn $ name $ pif ))

The test script:
=======================================

#!/usr/bin/perl

use Net::LDAP;

$ldap = Net::LDAP->new('localhost');

# bind to a directory with dn and password
$mesg = $ldap->bind('cn=admin,dc=nodomain',
                    password => 'password'
                    );

$mesg->code && die $mesg->error;

my $result = $ldap->add("dc=subting,dc=nodomain",
                        attr => [
                                 dc=>"subting",
                                 o=>'pifpafpuf',
                                 objectclass=>['top','dcObject',
'organization'],
                                 ],
                        );
$result->code && die "failed to add entry: ", $result->error ;



# Insert data

my $t1 = time;

for (my $i = 1; $i<=20000; $i++) {
    my $result = $ldap->add("cn=$i,dc=subting,dc=nodomain",
                            attr => [
                                     cn=>"$i",
                                     name=>"aaaaaaaaaaaa",
                                     pif=> [$i,$i+100000,$i+200000],
                                     objectclass=>['top','pifpafpuf'],
                                     ],
                            );
    $result->code && die "failed to add entry: ", $result->error ;
}

my $t2 = time;
print "INSERT: ",$t2-$t1,"\n";
$t1=$t2;

# Look up data on index

for (my $i = 1; $i<=20000; $i++) {
    $mesg = $ldap->search(
                           base   => "dc=nodomain",
                           filter => "(cn=$i)"
                           );
    $mesg->code && die $mesg->error;
}

my $t2 = time;
print "INDEXLOOKUP: ",$t2-$t1,"\n";
$t1=$t2;

# Look up data  - no index

for (my $i = 1; $i<=10000; $i++) {
    $mesg = $ldap->search(
                           base   => "dc=nodomain",
                           filter => "(pif=$i)"
                           );
    $mesg->code && die $mesg->error;
}

my $t2 = time;
print "LOOKUP: ",$t2-$t1,"\n";