Module mod_ldap

This module is not included with the standard distribution. It is available via CVS in the http-ldap module.

This module adds LDAP connection pooling and result caching to other Apache LDAP modules (like mod_auth_ldap).

Status: Extension
Source File: util_ldap.c
Module Identifier: ldap_module
Compatibility: Available in Apache 2.0 and later.

Summary

This module was created to improve the performance of websites relying on backend connections to LDAP servers. In addition to the functions provided by the standard LDAP libraries, this module adds an LDAP connection pool and an LDAP shared memory cache.

To enable this module, LDAP support must be compiled into apr-util. This is achieved by adding the --with-ldap flag to the ./configure script when building Apache.

Directives

LDAP Connection Pool

LDAP connections are pooled from request to request. This allows the LDAP server to remain connected and bound ready for the next request, without the need to unbind/connect/rebind. The performance advantages are similar to the effect of HTTP keepalives.

On a busy server it is possible that many requests will try and access the same LDAP server connection simultaneously. Where an LDAP connection is in use, Apache will create a new connection alongside the original one. This ensures that the connection pool does not become a bottleneck.

There is no need to manually enable connection pooling in the Apache configuration. Any module using this module for access to LDAP services will share the connection pool.

LDAP Cache

For improved performance, mod_ldap uses an aggressive caching strategy to minimize the number of times that the LDAP server must be contacted. Caching can easily double or triple the throughput of Apache when it is serving pages protected with mod_auth_ldap. In addition, the load on the LDAP server will be significantly decreased.

mod_ldap supports two types of LDAP caching during the search/bind phase with a search/bind cache and during the compare phase with two operation caches. Each LDAP URL that is used by the server has its own set of these three caches.


LDAPSharedCacheSize directive

Syntax: LDAPSharedCacheSize bytes
Context: server config
Override: Not Applicable
Status: Extension
Module: mod_ldap

Specifies the number of bytes to specify for the shared memory cache. The default is 100kb.


LDAPCacheEntries directive

Syntax:LDAPCacheEntries size
Context: server config
Override: Not Applicable
Status: Extension
Module: mod_ldap

Specifies the maximum size of the primary LDAP cache. This cache contains successful search/binds. Set it to 0 to turn off search/bind caching. The default size is 1024 cached searches.


LDAPCacheTTL directive

Syntax: LDAPCacheTTL seconds
Context: server config
Override: Not Applicable
Status: Extension
Module: mod_ldap

Specifies the time (in seconds) that an item in the search/bind cache remains valid. The default is 600 seconds (10 minutes).


LDAPOpCacheEntries directive

Syntax: LDAPOpCacheEntries seconds
Context: server config
Override: Not Applicable
Status: Extension
Module: mod_ldap

This specifies the number of entries mod_ldap will use to cache LDAP compare operations. The default is 1024 entries. Setting it to 0 disables operation caching.


LDAPOpCacheTTL directive

Syntax: LDAPOpCacheTTL seconds
Context: server config
Override: Not Applicable
Status: Extension
Module: mod_ldap

Specifies the time (in seconds) that entries in the operation cache remain valid. The default is 600 seconds.


LDAPCertDBPath directive

Syntax: LDAPCertDBPath directory-path
Context: server config
Override: Not Applicable
Status: Extension
Module: mod_ldap

This directive is only valid if Apache has been linked against the Netscape/iPlanet Directory SDK.

It specifies in which directory mod_ldap should look for the certificate authorities database for SSL support. There should be a file named cert7.db in that directory.