Following describes memory usage of SAFR DB (which use Mongo DB)
- Mongo will use as much memory as it can to keep both data and indexes in memory.
- Following defines memory that is allocated to Mongo to use:
- If system is <16GB RAM, Mongo is allocated 1G RAM
- If system is between 16 and 48GB RAM, Mongo is allocated 1/3 of system RAM less 1GB
- e.g. if 32 GB RAM, Mongo is allocated 32/3 - 1 = 9.6 GB RAM
- If system is greater than 48GB RAM, Mongi is allocated 1/2 of system ram less 1GB RAM
- e.g. if 64 GB RAM, Mongo will be allocated 32 - 1 = 31 GB RAM
- Mongo will start to load all indexes into memory. I don't know exact math for how large an index is but its 100% correlated to db size and some fraction of db size (i.e. each new record adds size to index)
- Mongo will attempt to keep any event data that is read or written since last startup time in memory.
- Events are 1k in size for text data plus size of images (typically 20k for face image and 30k for scene image)
- If mongo reaches limit of memory, oldest events are dropped from memory and most recent are kept. Indexes always remain in RAM.
- Note: Each service is also allocated heap space and this will typically take up almost all of 14 GB RAM if system has sufficient RAM but we will reduce that if system has less RAM.