Clément OUDOT wrote: > > Le 07/05/2024 à 17:07, Benjamin Renard a écrit : >> Hi, >> >> I'm looking for the right method to monitor the usage of an MDB database >> according to the limit of its size imposed via the parameter olcDbMaxSize. >> Currently, >> I am using the following command: >> >> # mdb_stat -e /var/lib/ldap/accesslog/ >> Environment Info >> Map address: (nil) >> Map size: 4294967296 >> Page size: 4096 >> Max pages: 1048576 >> Number of pages used: 1048572 >> Last transaction ID: 24153425 >> Max readers: 126 >> Number of readers used: 18 >> Status of Main DB >> Tree depth: 1 >> Branch pages: 0 >> Leaf pages: 1 >> Overflow pages: 0 >> Entries: 6 >> >> Here, I determine the percentage of database usage with the information >> "Number of pages used" and "Max pages". >> >> This seemed to be a good method, but I noticed that after a significant >> purge of objects in the directory, the number of used pages does not seem to >> decrease.
You also need to account for the freelist. Use `mdb_stat -ef`. >> >> Is there another and/or better method to monitor this? Failing that, is >> there a solution to release "falsely" used pages, ideally without too much >> downtime of >> the service (so not a dump/restore)? I read that it was possible to use the >> "mdb_copy -c" command, but I am a little concerned about the duration on a >> database with approximately 1,000,000 entries. There is no reason to release free pages. They will get reused again anyway. > Hello Benjamin, > > if it helps, we have created a monitoring script for this: > https://ltb-project.org/documentation/check_lmdb_usage.html > -- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/
