Chapter 9. Tuning transaction logging
Every Directory Server instance contains a transaction log which logs updates of databases it manages. Whenever a directory database operation, such as a modify operation, is performed, the server creates a single database transaction for all of the database operations invoked as a result of that LDAP operation. This includes both updating the entry record in the database file containing the entries and updating all attribute indexes. If all of the operations succeed, the server commits the transaction, writes the operations to the transaction log, and verifies that the entire transaction is written to disk. If any of these operations fail, the server rolls back the transaction, and all of the operations are discarded. This all-or-nothing approach guarantees that an update operation is atomic. Either the entire operation succeeds permanently and irrevocably, or it fails.
Periodically, Directory Server flushes the contents of the transaction logs to the actual database index files and checks if the transaction logs require trimming.
If the server experiences a failure, such as a power outage, and shuts down abnormally, the information about recent directory changes is still saved by the transaction log. When the server restarts, the server automatically detects the error condition and uses the database transaction log to recover the database.
Although database transaction logging, flush the database, trimming, and database recovery are automatic processes that require no intervention, it can be advisable to tune some of the database transaction logging attributes to optimize the performance.
9.1. Changing the database checkpoint interval using the command line
At regular intervals, Directory Server writes the transactions logged logged in the transaction log to the database files and logs a checkpoint entry in the database transaction log. By indicating which changes have already been written to the database, checkpoint entries indicate where to begin recovery from the transaction log, thus speeding up the recovery process.
By default, Directory Server sends a checkpoint entry to the database transaction log every 60 seconds. Increasing the checkpoint interval can increase the performance of directory write operations. However, it can also increase the amount of time required to recover directory databases after a disorderly shutdown and require more disk space due to large database transaction log files.
Procedure
Change the checkpoint interval, for example, to 120 seconds:
# dsconf -D "cn=Directory Manager" ldap://server.example.com backend config set --checkpoint-interval=120
9.2. Changing the database checkpoint interval using the web console
At regular intervals, Directory Server writes the transactions logged logged in the transaction log to the database files and logs a checkpoint entry in the database transaction log. By indicating which changes have already been written to the database, checkpoint entries indicate where to begin recovery from the transaction log, thus speeding up the recovery process.
By default, Directory Server sends a checkpoint entry to the database transaction log every 60 seconds. Increasing the checkpoint interval can increase the performance of directory write operations. However, it can also increase the amount of time required to recover directory databases after a disorderly shutdown and require more disk space due to large database transaction log files.
Prerequisites
- You are logged in to the instance in the web console.
Procedure
-
Navigate to
. -
Click
Show Advanced Settings
. -
Update the value in the
Database Checkpoint Interval
field. - Click .
9.3. Disabling durable transactions
Durable transaction logging means that each LDAP update operation, comprised of a sequence of database operations in a transaction, is physically written to disk. Even though each LDAP operation can be comprised of multiple database updates, each LDAP operation is treated as a single database transaction. Each LDAP operation is both atomic and durable.
Turning off durable transactions can improve the write performance of Directory Server at the risk of data loss.
When you disable durable transaction logging, Directory Server writes every directory database operation to the database transaction log file but it may not be physically written to disk immediately. If a directory change was written to the logical database transaction log file but not physically written to disk at the time of a system crash, the change cannot be recovered. When durable transactions are disabled, the recovered database is consistent but does not reflect the results of any LDAP write operations that completed just before the system crash.
Note that you cannot change the nsslapd-db-durable-transaction
parameter if Directory Server is running.
Procedure
Stop the instance:
# dsctl instance_name stop
Edit the
/etc/dirsrv/slapd-instance_name/dse.ldif
file, and set thensslapd-db-durable-transaction
parameter in thecn=config,cn=ldbm database,cn=plugins,cn=config
entry tooff
:dn: cn=config,cn=ldbm database,cn=plugins,cn=config ... nsslapd-db-durable-transaction: off ...
Start the instance:
# dsctl instance_name start