如何释放Mongodb使用的缓存? [英] how to release the caching which is used by Mongodb?

查看:1890
本文介绍了如何释放Mongodb使用的缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mongodb使用内存映射文件,当我使用很长时间时,我发现ubuntu中的命令'free -m'使可用内存减少了,并且缓存使用了很多.那么杀死Mongodb的缓存仍然花费很多吗?如何释放缓存?

Mongodb use the Memory Mapped File ,when I use a long time , I see the free memory has left less by command 'free -m' in ubuntu and the caching use a lot. Then kill the Mongodb the caching still cost a lot ? how can I release the caching ?

推荐答案

MongoDB将(至少看起来)会使用大量可用内存,但实际上将其留给OS的VMM告知其释放内存(请参阅MongoDB文档中的缓存.)

MongoDB will (at least seem) to use up a lot of available memory, but it actually leaves it up to the OS's VMM to tell it to release the memory (see Caching in the MongoDB docs.)

您应该能够通过重新启动MongoDB释放所有内存.

You should be able to release any and all memory by restarting MongoDB.

但是,在某种程度上,MongoDB并没有真正使用"内存.

However, to some extent MongoDB isn't really "using" the memory.

例如,来自MongoDB文档检查服务器内存使用情况 ...

For example from the MongoDB docs Checking Server Memory Usage ...

取决于平台,您可能会看到 映射的文件作为内存 过程,但这不是严格的 正确的. Unix顶部可能会显示更多方法 给蒙哥的记忆比真的 合适的.操作系统( 虚拟内存管理器 取决于操作系统)管理内存 其中内存映射文件" 居住.通常显示此数字 在"free -lmt"之类的程序中.

Depending on the platform you may see the mapped files as memory in the process, but this is not strictly correct. Unix top may show way more memory for mongod than is really appropriate. The Operating System (the virtual memory manager specifically, depending on OS) manages the memory where the "Memory Mapped Files" reside. This number is usually shown in a program like "free -lmt".

它称为缓存"内存.

MongoDB使用LRU(最近最少使用)缓存算法来确定哪些页面发布,您将在这两个问题中找到更多信息...

MongoDB uses the LRU (Least Recently Used) cache algorithm to determine which "pages" to release, you will find some more information in these two questions ...

  • MongoDB limit memory
  • MongoDB index/RAM relationship
  • Mongod start with memory limit (You can't.)

这篇关于如何释放Mongodb使用的缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆