https://bugs.openldap.org/show_bug.cgi?id=9349
Issue ID: 9349 Summary: Performance problem when trying to remove a value from an indexed attribute Product: OpenLDAP Version: 2.4.45 Hardware: All OS: All Status: UNCONFIRMED Severity: normal Priority: --- Component: backends Assignee: bugs@openldap.org Reporter: gbuades@soffid.com Target Milestone: ---
Created attachment 762 --> https://bugs.openldap.org/attachment.cgi?id=762&action=edit Patch to improve attribute removal
I have an LDAP with MDB backend, and a groupOfUniqueNames with 50.000 members. The uniqueMember attribute is indexed.
When I try to remove a single user, the process takes more or less one minute to complete.
After debugging, I've just found out the process to identify the old values to remove from the index is not optimum, as the time required to compare the old and the new values depends on number of values ^ 2.
Taking advantage of the fact, that the values in the old and new attributes are ordered in the same way, I've build a patch to opmtimize this search process.
Now, the same operation takes 0.2 seconds, when it used to take 50s.
Thanks a lot for your effort, and I hope this contribution helps you and other users.
The attached file is derived from OpenLDAP Software. All of the modifications to OpenLDAP Software represented in the following patch(es) were developed by Soffid. Soffid has not assigned rights and/or interest in this work to any party. I, Gabriel Buades am authorized by Soffid, my employer, to release this work under the following terms.
Soffid hereby place the following modifications to OpenLDAP Software (and only these modifications) into the public domain. Hence, these modifications may be freely used and/or redistributed for any purpose with or without attribution and/or other notice.
The attached modifications to OpenLDAP Software are subject to the following notice: Copyright 2020 Soffid Redistribution and use in source and binary forms, with or without modification, are permitted only as authorized by the OpenLDAP Public License.