389ds / 389-ds-base

The enterprise-class Open Source LDAP server for Linux
https://www.port389.org/
Other
211 stars 90 forks source link

389ds DB size Looks Bigger #6334

Open Hariprasath-3091 opened 2 weeks ago

Hariprasath-3091 commented 2 weeks ago

Issue Description We see the DB Size of 389ds looks very big than usual where we suspect some tuning is needed accordingly.

Package Version and Platform:

Steps to Reproduce Steps to reproduce the behavior:

  1. Install the 389ds with above version.
  2. Enable a DB with 3000 records.
  3. you will see the DB size with more than 1 GB

Expected results Expecting the DB size to be less than 300MB

Screenshots image

Additional context We enabled below tuning already as below on the 389ds Instance dsconf slapd-localhost replication set-changelog --suffix "${MYBASE}" --max-age "1d"; dsconf slapd-localhost backend index add --attr sudohost --index-type eq --reindex userroot; dsconf slapd-localhost backend index add --attr ipserviceprotocol --index-type eq --reindex userroot; dsconf slapd-localhost backend index add --attr ou --index-type eq --reindex userroot; dsconf slapd-localhost backend index delete --attr uidNumber userroot; dsconf slapd-localhost backend index add --attr uidNumber --index-type eq --reindex userroot; dsconf slapd-localhost backend index delete --attr gidNumber userroot; dsconf slapd-localhost backend index add --attr gidNumber --index-type eq --reindex userroot; dsconf slapd-localhost backend index delete --attr memberuid userroot; dsconf slapd-localhost backend index add --attr memberuid --index-type eq --reindex userroot; dsconf slapd-localhost security set --tls-client-renegotiation=off; dsconf slapd-localhost config replace nsslapd-idletimeout=60; dsconf slapd-localhost config replace nsslapd-maxdescriptors=524288; dsconf slapd-localhost config replace nsslapd-conntablesize=64000; dsconf slapd-localhost config replace nsslapd-threadnumber=32; dsconf slapd-localhost config replace nsslapd-listenhost=0.0.0.0; dsconf slapd-localhost config replace nsslapd-securelistenhost=0.0.0.0;

tbordaz commented 2 weeks ago

Hi, I agree that 1Gb looks too much for 3000 entries. Could you provide the output of 'ls -l /var/lib/dirsrv/slapd-localhost/db /var/lib/dirsrv/slapd-localhost/db/*'

progier389 commented 2 weeks ago

IMHO, That is probably the db cache size that is too big because of the autotuning (autotuning database cache size is based on available system memory), I think that you need to disable the autotuning and configure a small database cache.

Hariprasath-3091 commented 2 weeks ago

@tbordaz

ls -l /var/lib/dirsrv/slapd-localhost/db /var/lib/dirsrv/slapd-localhost/db/*

ldapmaster01-389ds:/ # ls -l /var/lib/dirsrv/slapd-localhost/db /var/lib/dirsrv/slapd-localhost/db/*
-rw------- 1 dirsrv dirsrv         51 Sep 18 09:09 /var/lib/dirsrv/slapd-localhost/db/DBVERSION
-rw------- 1 dirsrv dirsrv      24576 Sep 18 09:09 /var/lib/dirsrv/slapd-localhost/db/__db.001
-rw------- 1 dirsrv dirsrv   54091776 Sep 23 15:04 /var/lib/dirsrv/slapd-localhost/db/__db.002
-rw------- 1 dirsrv dirsrv 1048567808 Sep 23 15:03 /var/lib/dirsrv/slapd-localhost/db/__db.003
-rw------- 1 dirsrv dirsrv    1081344 Sep 23 15:03 /var/lib/dirsrv/slapd-localhost/db/__db.004
-rw------- 1 dirsrv dirsrv    8863744 Sep 23 15:03 /var/lib/dirsrv/slapd-localhost/db/__db.005
-rw------- 1 dirsrv dirsrv      90112 Sep 23 15:03 /var/lib/dirsrv/slapd-localhost/db/__db.006
-rw------- 1 dirsrv dirsrv   10485760 Sep 23 15:04 /var/lib/dirsrv/slapd-localhost/db/log.0000000026

/var/lib/dirsrv/slapd-localhost/db:
total 1093232
-rw------- 1 dirsrv dirsrv         51 Sep 18 09:09 DBVERSION
-rw------- 1 dirsrv dirsrv      24576 Sep 18 09:09 __db.001
-rw------- 1 dirsrv dirsrv   54091776 Sep 23 15:04 __db.002
-rw------- 1 dirsrv dirsrv 1048567808 Sep 23 15:03 __db.003
-rw------- 1 dirsrv dirsrv    1081344 Sep 23 15:03 __db.004
-rw------- 1 dirsrv dirsrv    8863744 Sep 23 15:03 __db.005
-rw------- 1 dirsrv dirsrv      90112 Sep 23 15:03 __db.006
-rw------- 1 dirsrv dirsrv   10485760 Sep 23 15:04 log.0000000026
drwx------ 2 dirsrv dirsrv       4096 Sep 15 04:52 userroot

/var/lib/dirsrv/slapd-localhost/db/userroot:
total 30740
-rw------- 1 dirsrv dirsrv       51 Sep 18 09:09 DBVERSION
-rw------- 1 dirsrv dirsrv    16384 Sep 15 01:45 aci.db4
-rw------- 1 dirsrv dirsrv   638976 Sep 23 10:37 ancestorid.db4
-rw------- 1 dirsrv dirsrv  1392640 Sep 23 10:37 cn.db4
-rw------- 1 dirsrv dirsrv  2424832 Sep 23 10:37 entryrdn.db4
-rw------- 1 dirsrv dirsrv    90112 Sep 23 10:37 gidNumber.db4
-rw------- 1 dirsrv dirsrv   262144 Sep 23 03:10 givenName.db4
-rw------- 1 dirsrv dirsrv 18243584 Sep 23 15:03 id2entry.db4
-rw------- 1 dirsrv dirsrv    40960 Sep 23 10:37 ipserviceprotocol.db4
-rw------- 1 dirsrv dirsrv   638976 Sep 23 03:10 mail.db4
-rw------- 1 dirsrv dirsrv   614400 Sep 23 14:09 memberuid.db4
-rw------- 1 dirsrv dirsrv    16384 Sep 23 09:10 nsTombstoneCSN.db4
-rw------- 1 dirsrv dirsrv    16384 Sep 23 09:10 nscpEntryDN.db4
-rw------- 1 dirsrv dirsrv    16384 Sep 15 04:52 nsds5ReplConflict.db4
-rw------- 1 dirsrv dirsrv   933888 Sep 23 10:37 nsuniqueid.db4
-rw------- 1 dirsrv dirsrv    16384 Sep 23 10:37 numsubordinates.db4
-rw------- 1 dirsrv dirsrv   548864 Sep 23 10:37 objectclass.db4
-rw------- 1 dirsrv dirsrv   122880 Sep 23 10:37 ou.db4
-rw------- 1 dirsrv dirsrv   352256 Sep 23 10:37 parentid.db4
-rw------- 1 dirsrv dirsrv  3612672 Sep 23 14:16 replication_changelog.db4
-rw------- 1 dirsrv dirsrv   851968 Sep 23 10:37 sn.db4
-rw------- 1 dirsrv dirsrv    16384 Sep 15 00:11 sudohost.db4
-rw------- 1 dirsrv dirsrv   253952 Sep 22 17:11 telephoneNumber.db4
-rw------- 1 dirsrv dirsrv   180224 Sep 23 10:37 uid.db4
-rw------- 1 dirsrv dirsrv   163840 Sep 23 10:37 uidNumber.db4
ldapmaster01-389ds:/ #
tbordaz commented 2 weeks ago

Like @progier389 said the culprit was the dbcache (__db.003 that is 1Gb by itself). This size is defined by autotuning. You may disable it and tune the attribute 'nsslapd-dbcachesize' (cn=bdb,cn=config,cn=ldbm database,cn=plugins,cn=config). The dbcache does not need to located on disk. In recent versions, for performance benefit, it is located on tmpfs 'nsslapd-db-home-directory=/dev/shm/slapd-instance'