[turba] LDAP seach through turba is slow

S. Yoder yodersj at earthlink.net
Thu Jan 9 16:21:53 PST 2003


When trying to browse or search via turba it often takes a full minute before
results are returned. More often it times out. However, searching via "Address
Book" (imp compose window) is very fast.

Running 'top' and watching the processes when a turba search query is executed
or the browse page is loaded shows slapd using ~90% of the CPU, with apache at
around 5%. The symptoms of what I am calling a timeout are the search results
page will display, though it is blank of results, and slapd and apache will
drop back down to 0%. Interestingly, when this happens, I can't do access any
other page that is part of the horde framework except the horde/test.php page
until I restart apache. There are no error logs, though I may need to bump a
log level up somewhere.

I should note that when I only had 4 entries to the branch "ou=contacts",
search and browse worked fine. I now have around 2500 entries under that
branch. (It's a business contact list, which is why there are so many.)

I have a quick PHP/LDAP test page I snaged from somewhere else that works fine
and fast. I've included it at the end.

In my sources.php you'll see some map items rem'd. I had to do this in order
to get any sort of results off a search I knew would only return a few items
without a timeout. You'll also notice some map items that are not in
attributes.php. I added those definitions.

Versions:
Turba 1.2 (CVS, RELENG_1, downloaded 01/06/03)
Horde 2.1
Imp 3.1
Openldap 2.0.27 (stable)
Apache 2.0.4
PHP 4.2.2
horde/test.php is green across the board.

Turba sources.php:
$cfgSources['localldap'] = array(
    'title' => 'Contacts',
    'type' => 'ldap',
    'params' => array(
        'server' => 'localhost',
        'port' => 389,
        'root' => 'ou=contacts,dc=example,dc=com',
        'bind_dn' => '',
        'bind_password' => '',
        'dn' => array('cn'),
        'objectclass' => 'inetOrgperson',
        'version' => 3
    ),
    'map' => array(
        '__key' => 'dn',
        'name' => 'cn',
        'email' => 'mail',
//        'title' => 'o',
        'company' => 'o',
//        'workPhone' => 'telephonenumber',
//        'mobile' => 'mobile',
//        'fax' => 'fax = facsimiletelephonenumber',
//        'homePhone' => 'homephone',
//        'workAddress' => 'street',
//        'poBox' => 'postofficebox',
//        'city' => 'l',
//        'state' => 'st',
//        'country' => 'c',
//        'zip' => 'postalcode',
//        'category' => 'businesscategory',
        'notes' => 'description'
    ),
    'search' => array(
        'name',
        'company'
    ),
    'strict' => array(
        'dn'
    ),
    'public' => true,
    'readonly' => true,
    'admin' => array(),
    'export' => true
);

My horde.php:
/**
 ** General Horde Settings
 **/
$conf['debug_level'] = E_ALL;
$conf['max_exec_time'] = 0;
$conf['session_name'] = 'Horde';
$conf['use_ssl'] = 2;
$conf['compress_pages'] = true;
$conf['umask'] = 077;
$conf['tmpdir'] = null;
/**
 ** Horde Authentication
 **/
//Basic imap setup
/**
 ** Horde Logging
 **/
$conf['log']['enabled'] = true;
$conf['log']['type'] = 'file';
$conf['log']['name'] = '/var/log/horde.log';
$conf['log']['priority'] = LOG_NOTICE;
$conf['log']['ident'] = 'HORDE';
$conf['log']['params'] = array();
/**
 ** Preference System Settings
 **/
$conf['prefs']['driver'] = 'none';
$conf['prefs']['params'] = array();
/**
 ** Cache System Settings
 **/
$conf['cache']['driver'] = 'none';
// (rest of basic setup)

My test.php for LDAP (careful of the line wraps):
<?php
$ds = ldap_connect("ldap://localhost/");
echo "connect result is ".$ds."<p>";
if($ds) {
 $r=ldap_bind($ds);
 echo "Bind result is ".$r."<p>";
 $sr=ldap_search($ds, "ou=contacts,dc=example,dc=com", "o=*Example*");
 echo "Search result is ".$sr."<p>";
 echo "Number of entires returned is ".ldap_count_entries($ds,$sr)."<p>";
 echo "Getting entries ...<p>";
 $info = ldap_get_entries($ds, $sr);
 echo "Data for ".$info["count"]." items returned:<p>";
 for ($i=0; $i<$info["count"]; $i++) {
  echo "dn: ". $info[$i]["dn"] ."<br>";
  echo "cn: ". $info[$i]["cn"][0] ."<br>";
  echo "mail: ". $info[$i]["mail"][0]."<br>";
  echo "title: ". $info[$i]["title"][0]."<br>";
  echo "o: ". $info[$i]["o"][0]."<br>";
  echo "street: ". $info[$i]["street"][0]."<br>";
  echo "postOfficeBox ". $info[$i]["postofficebox"][0]."<br>";
  echo "l: ". $info[$i]["l"][0]."<br>";
  echo "st: ". $info[$i]["st"][0]."<br>";
  echo "c: ". $info[$i]["c"][0]."<br>";
  echo "postalCode: ". $info[$i]["postalcode"][0]."<br>";
  echo "telephoneNumber: ". $info[$i]["telephonenumber"][0]."<br>";
  echo "homePhone: ". $info[$i]["homephone"][0]."<br>";
  echo "mobile: ". $info[$i]["mobile"][0]."<br>";
  echo "facsimileTelephoneNumber: ".
$info[$i]["facsimiletelephonenumber"][0]."<
  echo "businessCategory: ". $info[$i]["businesscategory"][0]."<br>";
  echo "description: ". $info[$i]["description"][0]."<p>";
 }
}
echo "Closing connection";
ldap_close($ds);
?>

Thanks for the help,
Stef


More information about the turba mailing list