How can I tell why ndsd (eDirectory) is consuming memory?

  • 7002714
  • 20-Feb-2009
  • 08-Nov-2012

Environment

Novell eDirectory 8.8 for Linux
Novell eDirectory 8.7.3 for Linux

Situation

How can I tell why ndsd (eDirectory) is consuming memory?

Resolution

ndsd memory consumption can be split into three areas:

  • eDirecotory Database cache (Flaim Cache)
  • eDirectory threads (Worker Threads)
  • ndsd processes ( including LDAP, Novell Audit, Novell Identity Manager,etc)

To determine the total amount of memory being consumed by ndsd, do the following:

1. Find the pid for the nds daemon (ndsd.)

sd145:/ # ps -e | grep ndsd
28125 ?        01:42:28 ndsd
(in this example 28125 is the pid for ndsd)

2. Use top to show the amount of Resident (RES) and Virtual (VIRT) memory being used for ndsd.
(using the pid from the command above)

sd145:/ # top -p 28125
or
sd145:/ # top -p `pgrep ndsd`

PID      USER   PR    NI    VIRT    RES    SHR  S   %CPU  %MEM    TIME+        COMMAND
28125   root      19      0     391m    61m    10m    S       0.7       12.2      102:37.91   ndsd

3. Now that you have the amount of Resident and Virtual Memory  for ndsd, we'll look at how this is broken up.

Total ndsd memory includes the following:  eDirectory cache, eDirectory threads, and ndsd processes (including LDAP, Novell Audit, Novell Identity Manager, etc)

Note: We cannot guarantee the actual amount of memory being used by a process, however Resident memory (RES) denotes memory used for stack, executable code, and data.  In other words, Resident memory (RES) is the minimum amount of memory that the process is using.  On the other hand, Virtual memory (VIRT) is the maximum amount of memory that a process can use or the amount of memory available to the process.


eDirectory cache - Novell recommends setting a static hard limit, preallocated cache for ndsd.  See TID# 7002682 for instructions on How to enable eDirectory cache preallocation.  As of Feb 2009, both OES and OES2 SP1 set a default hard limit, preallocated cache to 64mb.  (The limit has been increased to 190mb in OES2 SP2.)  This setting should be tuned to meet your directory needs.

To determine the current eDirectory cache setting on your Linux server, look at the following file:

eDirectory 8.8.x
/var/opt/novell/eDirectory/data/dib/_ndsdb.ini

eDirectory 8.7.3
/var/novell/nds/_ndsdb.ini

Example of _ndsdb.ini

cache=67108864
preallocatecache=true
cacheadjustinterval=15
cachecleanupinterval=15
blockcachepercent=50

Note: From the _ndsdb.ini, cache= is stated in bytes, therefore the above eDirectory cache setting is 64mb (or 67108864 bytes)

eDirectory threads - Running the following command will display the max threads eDirectory can create.

sd145:/ # ndsconfig get | grep max-threads
n4u.server.max-threads=128

For eDirectory 8.8.x, each thread created will take 1mb of memory.  Therefore, if the max-threads are set to 128,  and all 128 threads are in use, then ndsd will consume 128 threads x 1mb = 128mb of memory.

For eDirectory 8.7.3, each thread created will by default take 4mb of memory. Therefore, if the max-threads are set to 128 and all 128 threads are in use, then ndsd will consume 128 threads  x 4mb = 512mb of memory.  If necessary, the thread size can be configured.  See TID #3292730for details.

To see the current max-threads used, run the following command:
sd145:/ # ndstrace -c threads
Pool Workers : Idle 7, Total 33, Peak 34

On the "Pool Workers" line, look at the Total number. Total is the number of threads that are currently in use.


ndsd process (including LDAP, Novell Audit, and Novell Identity Manager) - The remaining ndsd memory has been allocated for normal eDirectory operations.