Univention Bugzilla – Bug 41281
use nosync for mdb during join and slapindex
Last modified: 2016-09-29 21:21:50 CEST
A customer suggested to set the nosync flag for mdb in univention-join while the LDAP is initially replicated. Additionally, nosync should be set while slapindex is called (automatically). Afterwards is should be set to the old state.
The customer reduced the amount of time required for a slapindex from 2 hours down to about 20 seconds.
What does the "nosync" flag do?
"nosync" turns off syncing the database to disk after every transaction, which is very useful for slapindex, which would otherwise do an fdatasync after indexing every single LDAP object. As Sönke said this reduces the run time of slapindex from 2 hours to a couple of seconds on many of our school slaves.
It would greatly benefit us if /usr/share/univention-ldap/ldap_setup_index would set this parameter before invoking slapindex, especially when we do several index-changing UCS updates in a row.
After some research I believe that running "slapindex -q" would basically do the same as setting the "nosync" MDB option. Plus, with '-q' slapindex makes use of the "tool-threads" option, which is already configurable via UCR, so it can run multi-threaded.
Of course, all of this comes at the cost of data integrity in case of a system failure while indexing, but as long as it is not the master LDAP being indexed, this is an acceptable price to pay, since one could just rejoin the failed machine.
So in short: A UCR variable that would let us use "-q" in automated slapindex scenarios would be highly appreciated.
(In reply to Sönke Schwardt-Krummrich from comment #0)
> A customer suggested to set the nosync flag for mdb in univention-join while
> the LDAP is initially replicated.
works for me with:
-> ucr set ldap/database/mdb/envflags='nosync' && \
univention-join && \
ucr unset ldap/database/mdb/envflags && \
service slapd restart
Added UCR variable ldap/index/quickmode, If true "ldap_setup_index" starts slapindex in "quick" mode.
merged to 4.2
One small issue: Can you describe in the UCR variable what the default is?
root@master411:~# ucr search ldap/index/quickmode
If this option is activated, the LDAP reindex tool slapindex is started in "quick" mode (fewer integrity checks, improved indexing time).
OK, univention-ldap-server now sets a default for ldap/index/quickmode. Added default to description.
Code review: OK