#409 Report during startup if nsslapd-cachememsize is too small
Closed: wontfix None Opened 11 years ago by rcritten.

The server should be able to compare the size of id2entry.db with the configured value of nsslapd-cachememsize and at least whine if the cache allocation is too small by default:

"You have XYZ bytes allocated to the cache. ABC is recommended"


Hi Rob, could you give us your feedback?

Let's assume we have 3 backends: userRoot, NetscapeRoot, mycom.

Case 1) each entry cache size is larger than the size of id2entry.db.
By default, it reports nothing. If the log level 0x80000 == 524288 is set, these sizes are logged in the errors log:
[...] - userRoot: entry cache size: 1048576000B; db size: 271990784B
[...] - NetscapeRoot: entry cache size: 104857600B; db size: 90112B
[...] - mycom: entry cache size: 104857600B; db size: 2744320B
[...] - Total entry cache size: 1258291200B; dbcache size: 10000000B; available memory size: 3961982976B

Case 2) one of the entry cache is less than the size of id2entry.db.
By default, it reports only the smaller cache size:
[...] - WARNING: userRoot: entry cache size 10485760B is less than db size 271990784B; We recommend to increase the entry cache size nsslapd-cachememsize.
If the log level 0x80000 == 524288 is set, it's logged in with other info:
[...] - WARNING: userRoot: entry cache size 10485760B is less than db size 271990784B; We recommend to increase the entry cache size nsslapd-cachememsize.
[...] - NetscapeRoot: entry cache size: 104857600B; db size: 90112B
[...] - mycom: entry cache size: 104857600B; db size: 2744320B
[...] - Total entry cache size: 220200960B; dbcache size: 10000000B; available memory size: 3961982976B

Case 3) total cache is less than the physical memory size.
By default:
[...] - WARNING -- Possible CONFIGURATION ERROR -- cachesize (3688353792) may be configured to use more than the available physical memory.
Log level 0x80000:
[...] - WARNING -- Possible CONFIGURATION ERROR -- cachesize (3688353792) may be configured to use more than the available physical memory.
[...] - userRoot: entry cache size: 4048576000B; db size: 271990784B
[...] - NetscapeRoot: entry cache size: 104857600B; db size: 90112B
[...] - mycom: entry cache size: 104857600B; db size: 2744320B
[...] - Total entry cache size: 4258291200B; dbcache size: 10000000B; available memory size: 3961982976B

Replying to [comment:3 nhosoi]:

Hi Rob, could you give us your feedback?

Let's assume we have 3 backends: userRoot, NetscapeRoot, mycom.

Case 1) each entry cache size is larger than the size of id2entry.db.
By default, it reports nothing.

Yes, by default is should log nothing so these really stand out. I like the idea of being able to get a report at a certain debug level.

Case 2) one of the entry cache is less than the size of id2entry.db.
By default, it reports only the smaller cache size:

Perfect.

Case 3) total cache is less than the physical memory size.

I think you mean total cache is more than physical memory size. In that case then yes, I think this should also complain loudly.

The format of these messages is very nice and clear.

Thank you so much for the feedback, Rob!

I'm sending a review request now...

Fix description: adding a code to compare the entry cache size with
the main db file (id2entry.db) size. If the entry cache size is
less than the db file size, it logs the warning in the error log.

Reviewed by Mark (Thanks!!!)

Pushed to master.

$ git merge trac409
Updating 6a21e8e..950c0c6
Fast-forward
ldap/servers/slapd/back-ldbm/dblayer.c | 39 +++++++++++++++++++----
ldap/servers/slapd/back-ldbm/proto-back-ldbm.h | 1 +
ldap/servers/slapd/back-ldbm/start.c | 36 ++++++++++++++++++++--
3 files changed, 66 insertions(+), 10 deletions(-)

$ git push
Enter passphrase for key '/home/nhosoi/.ssh/id_rsa':
Counting objects: 17, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 1.70 KiB, done.
Total 9 (delta 7), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
6a21e8e..950c0c6 master -> master

Note that even with this change, if the server reports that sizeof(id2entry) < sizeof(entrycache) you can still run into the situation where the entrycache size is not large enough to hold all of the entries in id2entry, unless the sizeof(entry in id2entry) < sizeof(entry in entrycache)

Replying to [comment:9 rmeggins]:

Note that even with this change, if the server reports that sizeof(id2entry) < sizeof(entrycache) you can still run into the situation where the entrycache size is not large enough to hold all of the entries in id2entry, unless the sizeof(entry in id2entry) < sizeof(entry in entrycache)

Agreed. More precisely, slapi_Entry requires extra space (e.g., pointers and flags) in addition to the ldif data. On the other hand, the db file contains the B+ tree overhead.

Plus, if the db encryption is enabled, the size difference could be larger. In the future, we may introduce the compression to the backend. If it happens, this simple comparison against the file size loses the ground.

Added initial screened field value.

Metadata Update from @nhosoi:
- Issue assigned to nhosoi
- Issue set to the milestone: 1.2.11.8

7 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/409

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

3 years ago

Login to comment on this ticket.

Metadata