Search code examples
javacachingldapheap-memoryopendj

OpenDJ dbcache implementation - where is it located in RAM?


I'm trying to understand how memory allocation for dbcache is being handled by OpenDJ in tandem with java vm. There is a couple of things I couldn't get completely, though. As mentioned here, it's possible to allocate some predefined amount of RAM for the sole purpose of caching the database. It also mentioned here and there, that OpenDJ may attempt to store as much db files in memory as possible. 2 questions so far:

  1. Is dbcache actually a part of the heap? If answer is "yes", then where exactly is memory for it being allocated? I.e., is it the Old Generation space, Permanent Generation space, or even Young Generation space? Or may be it is neither of them, and it cannot be seen in usual heap memory zone's (meaning it isn't placed in the heap, but in its own memory space which size is simply derived from the size of the heap using the settings this article mentions)?
  2. Can I somehow ensure (i.e. is there specific settings for that in the OpenDJ) that my complete db is cached during service's start up, and make sure that otherwise (i.e. if allocated RAM's size isn't set correctly, or there is not enough RAM) the service simply won't start?

Any help is appreciated.


Solution

  • Funny you're referring to my blog... 1/ Yes, dbcache is part of the JVM heap. OpenDJ let the JVM decides where to allocate the dbcache. Normally it is allocated in the New Generation space, but if the amount to be allocated exceeds the size of the New Gen, it's allocated in the Old Generation space.

    2/ OpenDJ has an option to specify whether the server should pre-load the cache and the maximum amount of time it should spend trying to pre-load it. Please check the OpenDJ administration guide, and it's Tuning For Performance section for details.

    There is no way to prevent the server from starting if the whole DB is not cached. I cannot think of a valid use case for this specific behaviour.