6.2. Determining the Required Cache Sizes

The dbmon.sh script enables you to monitor cache statistics at runtime and continuously outputs the statistics. To terminate the script, press the Ctrl+C key combination.

Note

The dbmon.sh requires you to pass the options as environment variables to the script. For further details see the Directory Server Configuration, Command, and File Reference.

Example 6.2. Using the dbmon.sh Script

To display the statistics, enter for example:
# BINDDN="cn=Directory Manager" BINDPW=secret SERVID=slapd-instance_name dbmon.sh
dbcachefree 397310 free% 2.2 roevicts 9282348 hit% 50 pagein 2934772 pageout 219075
      dbname            count          free  free%    size
      userroot:ent      50000          2400    0.8  8972.7
      userroot:dn      100000       4294735   69.8   130.0
To list the total number of DNs in the userroot database, enter:
# dbscan -f /var/lib/dirsrv/slapd-instance_name/db/userRoot/id2entry.db -t 200 | \
     grep -c rdn:
If your caches are sufficiently sized, the number returned by the previous command matches the value in the count column of the dbmon.sh script's output. Additionally, if all of the entries and DNs fit within their respective caches, the userroot:ent count value matches the userroot:dn count value.
The output of the dbmon.sh script example shows:
  • Only 2.2% free database cache is left:
    dbcachefree 397310 free% 2.2 roevicts 9282348 hit% 50 pagein 2934772 pageout 219075
    However, to operate efficiently, at least 15% free database cache is required. To determine the optimal size of the database cache, calculate the sizes of all *.db and *.db4 files in the /var/lib/dirsrv/slapd-instance_name/db/ directory including subdirectories and the changelog database, and add 12% for overhead.
    To set the database cache, see Section 6.5, “Setting the Database Cache Size”.
  • The DN cache of the userroot database is well-chosen:
    dbname            count          free  free%    size
    userroot:dn      100000       4294735   69.8   130.0
    The DN cache of the database contains 100000 records. 69,8% of the cache is free. Based on the count value and the bytes used, each DN in memory requires 130 bytes on average.
  • The statistics on the entry cache of the userroot database indicates that the entry cache value should be increased for better performance:
    dbname            count          free  free%    size
    userroot:ent      50000          2400    0.8  8972.7
    The entry cache contains in this database 50000 records and only 2 Kilobytes of free space are left. To enable Directory Server to cache all 100000 DNs, reported by the dbscan utility's output, the cache must be increased to minimum of 856 Megabytes (100000 DNs * 8972,7 bytes average entry size). However, it is recommended to round the minimum required size to the next highest Gigabyte and double the result. In this example, the entry cache should be set to 2 Gigabytes.