26 April 2016
26 April 2016,
 Off

April 26, 2016

By Andrey LomakinLead Research & Development Engineer at OrientDB.

Many users ask how much memory is consumed by OrientDB and which settings affect this. This question becomes even more pertinent since the OrientDB 2.2 release. In this latest release, we allocate memory in big chunks (about of 1gb size each) and then split it between threads on demand.

There are 2 reasons why we have chosen this approach:ram logo

  1. To fix OS allocation issues like this one
  2. To prepare for the change when we assign adjacent memory chunks for each thread on demand. As an example, lets suppose the first thread got a page with address 0x1 but second thread got a page with address 0xFE. Then on the next request for a new page the first thread will get a page with address 0x2 and second thread will get a page with address 0xFF. We hope It will allow us to improve system performance because of better CPU cache locality feature usage.

So how do you calculate maximum amount of memory consumed by OrientDB?  The answer to that is simple.  OrientDB uses both heap and direct memory. Direct memory is used in disk cache and database journal.

Memory consumed by disk cache may be calculated looking at the value of the storage.diskCache.bufferSize configuration parameter, which shows the maximum amount of memory consumed by disk cache in megabytes. The page cache size in kilobytes may be retrieved by reading the value of the storage.diskCache.pageSize parameter. It may be done using the console CONFIG GET command for example.  

You may get the maximum amount of pages consumed by the database journal by reading the value of the storage.wal.cacheSize parameter. You should increase this value by 1 and multiply by the value of the storage.diskCache.pageSize parameter. In this way you will get the maximum amount of direct memory consumed by the database journal.  After that we need to add both calculated values and increase the result until not divisible by 1GB without reminder.

The rest is simple. Add the value which you calculated above and add the amount of memory consumed by heap and you will get the maximum amount of memory which will be consumed by OrientDB.

UPDATE 1: Maximum size of memory chunk in bytes which will be allocated by OrientDB may be set using the memory.chunk.size property.

If you have any questions about this blog entry or about any of OrientDB’s features please post your question on stackoverflow and we will answer it.  For a complete guide on OrientDB’s features and properties be sure to read our Documentation.

 

Comments are closed.