国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

數(shù)據(jù)庫 - mongodb如何 清除占用的內(nèi)存
世界只因有你
世界只因有你 2017-04-26 09:01:54
0
2
1086

最近在學(xué)習(xí)使用mongodb,發(fā)現(xiàn)它內(nèi)存占用厲害,網(wǎng)上搜索了一下發(fā)現(xiàn)很多都利用use admin;db.runCommand({closeAllDatabases:1})來清除內(nèi)存,我在3.0中發(fā)現(xiàn)沒有該命令,

是3.0中取消了該命令還是我的打開的方法不對,查看了一下手冊也沒有發(fā)現(xiàn)類似的替代命令,請問最新版本中還有該命令么?如果有的話,應(yīng)該怎么使用呢?

世界只因有你
世界只因有你

reply all(2)
洪濤

I am also learning mongodb recently. I recommend you mongodb learning materials http://www.hubwiz.com/course/54bdfcb188dba012b4b95c9c/

劉奇

Many people think that there is a problem with the database taking up too much memory. In fact, this is not a problem at all and does not need to be solved.
First of all, the primary task of a database is to manage data. How to provide data queries faster is a problem that all databases need to solve. The solutions of each company are almost the same. Whether it is SQLServer, MySQL, or MongoDB, they all trade space for efficiency. In layman's terms, it is to use as much memory as possible and load all useful things (indexes, data, etc.) into memory as much as possible to improve running speed. So, this is definitely not a bug, but expected behavior. Thinking about it conversely, if a database runs slowly in order to save memory, this violates the basic purpose of a database.
Once you understand this, let’s look at your question.

  1. If you are in a production environment, there is no need to reclaim memory at all, because it will only make the instant efficiency very poor. And it doesn't work, because the database will reload the data from the disk later, causing high disk IO and affecting the write speed. So in the end, you only get temporary free memory, and query speed and write speed will be greatly affected. You can figure it out for yourself whether it’s a good deal or not.
  2. If this is a development environment and you don’t need to worry about these problems, restarting mongod can easily solve the problem. In addition, because you may want to further clear the data in the cache, you can use the Linux command: echo 3 > /proc/sys/vm/drop_caches

Reference:
Does MongoDB require a lot of RAM?
How do you empty the buffers and cache on a Linux system?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template