Fred Mériot
Fred Mériot

Reputation: 4357

MongoDB In-Memory Storage engine : what happens when memory is full?

I did not find answer in the mongodb documentation. What happens when the memory is full when using the MongoDB In-Memory Storage Engine?

Is there an eviction (LRU)? Is there an error message ? Is it configurable ?

Thank you

Upvotes: 0

Views: 2051

Answers (1)

Ebenezar John Paul
Ebenezar John Paul

Reputation: 1568

By default, the in-memory storage engine uses 50% of physical RAM minus 1 GB.

If a write operation would cause the data to exceed the specified memory size, MongoDB returns with the error:

"WT_CACHE_FULL: operation would overflow cache"

To specify a new size, use the storage.inMemory.engineConfig.inMemorySizeGB setting in the YAML configuration file format:

storage:
   engine: inMemory
   dbPath: <path>
   inMemory:
      engineConfig:
         inMemorySizeGB: <newSize>

Or use the command-line option --inMemorySizeGB:

mongod --storageEngine inMemory --dbpath <path> --inMemorySizeGB <newSize>

Btw, I found this in the official documentation, you may want to explore more.

Upvotes: 2

Related Questions