# WARNING: Before tuning the following parameters, _PLEASE READ_
#   /usr/share/doc/slapd/README.DB_CONFIG.gz

# Set the database in memory cache size.
#
# set_cachesize <gbytes> <bytes> <ncache>
#   Sets the database in memory cache size.
#   Database entries and indexes will be stored in this cache to
#   avoid disk access during database read and write operations.
#   Tuning this value can greatly effect your database performance.
#   The parameters are:
#      <gbytes>: The number of gigabytes of memory to allocate to the cache.
#      <bytes>: The number of bytes of memory to allocate to the cache.
#      <ncache>: The number of cache segments to use. If this value is set to
#          0 or 1 then Berkeley DB will try to allocate one contiguous section
#          of memory for the cache. If this value is greater than 1, the cache
#          will be split into that number of segments.
%if %%is_defined('import_slapadd')
set_cachesize   2       0        1
%else
set_cachesize   0       52428800        0
%end if


# Sets the database startup flags.
#
# set_flags <flag>
#   There are various flag options that may be set. The DB_TXN_NOSYNC flag
#   tells the database not to immediately flush transaction buffers to disk.
#   Setting this flag can help speed up database access during periods of
#   database write activity BUT at expense of data safety. Enable it only
#   to load data with slapadd, while slapd is not running.
%if %%is_defined('import_slapadd')
set_flags       DB_TXN_NOSYNC
%end if


# Set the maximum in memory cache in <bytes> for database file name caching.
#
# set_lg_regionmax <bytes>
#   This value should be increased as the number of database files increases
#   (tables and indexes).
#set_lg_regionmax        1048576

# Set the maximum size of log files in <bytes>.
#
# set_lg_max <bytes>
#   Logs will be rotated when <bytes> amount of data have been written to
#   one log file. This value should be at least four times the size of
#   set_lg_bsize.
#set_lg_max              10485760

# Set the in memory cache for log information.
#
# set_lg_bsize <bytes>
#   When <bytes> amount of logging information have been written to this
#   cache it will be flushed to disk.
set_lg_bsize            2097152

# Set the log file directory to <directory>.
#
# set_lg_dir              /usr/local/var/openldap-logs
#   Log files should preferably be on a different disk than the
#   database files. This both improves reliability (for disastrous
#   recovery) and speed of the database.
#set_lg_dir <directory>


# Sven Hartge reported that he had to set this value incredibly high
# to get slapd running at all. See http://bugs.debian.org/303057
# for more information.

# Number of objects that can be locked at the same time.
set_lk_max_objects      5000
# Number of locks (both requested and granted)
set_lk_max_locks        5000
# Number of lockers
set_lk_max_lockers	5000

# Purge automatique des logs
set_flags       DB_LOG_AUTOREMOVE
