MongoDB 内存存储引擎:内存已满时会发生什么?

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

我没有在 mongodb 文档中找到答案。使用 MongoDB 内存存储引擎时内存已满会发生什么?

有驱逐(LRU)吗? 有错误信息吗? 是否可配置?

谢谢

默认情况下,内存存储引擎使用 50% 的物理 RAM 减去 1 GB。

如果写入操作会导致数据超过指定的内存大小,MongoDB returns 错误:

"WT_CACHE_FULL: operation would overflow cache"

要指定新尺寸,请使用 storage.inMemory.engineConfig.inMemorySizeGB YAML配置文件格式设置:

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

或者使用命令行选项--inMemorySizeGB:

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

顺便说一句,我在 official documentation 中找到了这个,您可能想要探索更多。