6.2. Determining the Required Cache Sizes

The dsconf monitor dbmon command enables you to monitor cache statistics at runtime.
To display the statistics, enter:
# dsconf -D "cn=Directory Manager" ldap://server.example.com monitor dbmon
DB Monitor Report: 2020-06-24 11:31:27
--------------------------------------------------------
Database Cache:
 - Cache Hit Ratio:     50%
 - Free Space:          397.31 KB
 - Free Percentage:     2.2%
 - RO Page Drops:       0
 - Pages In:            2934772
 - Pages Out:           219075

Normalized DN Cache:
 - Cache Hit Ratio:     60%
 - Free Space:          19.98 MB
 - Free Percentage:     99.9%
 - DN Count:            100000
 - Evictions:           9282348

Backends:
  - dc=example,dc=com (userroot):
    - Entry Cache Hit Ratio:        66%
    - Entry Cache Count:            50000
    - Entry Cache Free Space:       2.0 KB
    - Entry Cache Free Percentage:  0.8%
    - Entry Cache Average Size:     8.9 KB
    - DN Cache Hit Ratio:           21%
    - DN Cache Count:               100000
    - DN Cache Free Space:          4.29 MB
    - DN Cache Free Percentage:     69.8%
    - DN Cache Average Size:        130.0 B
Optionally, pass the -b back_end or -x option to the command to display the statistics for a specific back end or the index.
If your caches are sufficiently sized, the number in DN Cache Count matches the values in the Cache Count backend entries. Additionally, if all of the entries and DNs fit within their respective caches, the Entry Cache Count count value matches the DN Cache Count value.
The output of the example shows:
  • Only 2.2% free database cache is left:
    Database Cache:
     ...
     - Free Space:          397.31 KB
     - Free Percentage:     2.2%
    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:
    Backends:
      - dc=example,dc=com (userroot):
        ...
        - DN Cache Count:               100000
        - DN Cache Free Space:          4.29 MB
        - DN Cache Free Percentage:     69.8%
        - DN Cache Average Size:        130.0 B
    
    The DN cache of the database contains 100000 records, 69,8% of the cache is free, and 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:
    Backends:
      - dc=example,dc=com (userroot):
      ...
        - Entry Cache Count:            50000
        - Entry Cache Free Space:       2.0 KB
        - Entry Cache Free Percentage:  0.8%
        - Entry Cache Average Size:     8.9 KB
    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, the cache must be increased to minimum of 890 MB (100000 DNs * 8,9 KB average entry size). However, Red Hat recommends to round the minimum required size to the next highest GB and double the result. In this example, the entry cache should be set to 2 Gigabytes.