当数据库大小大于RAM时,MongoDB可以工作吗? [英] Can MongoDB work when size of database larger then RAM?

查看:58
本文介绍了当数据库大小大于RAM时,MongoDB可以工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

还是当索引大于RAM时?

or when index larger then RAM?

推荐答案

是可以的.它将在多大程度上执行取决于"

Yes it can work. To what level it will perform is more of an "It Depends"

关键是要确保您的工作集可以放入RAM.因此,举例来说,如果您有16GB的RAM和20GB的数据库(包括索引),则由于另一半是较旧的/从未实际查询过而只需要访问所有数据的一半,则只需要访问一半的数据就可以了数据库需要在RAM(10GB)中.

The key thing is to ensure your working set can fit in RAM. So if you have 16GB of RAM and 20GB database (inc. indexes) for example, if you need to only access half of all the data as the other half is older/never actually queried then you'll be fine as only half of your database needs to be in RAM (10GB).

工作集是关键.例如,如果您有一个日志应用程序输出到MongoDB,则可能是您的工作集是过去3个月中的数据量(和索引),而您之前的所有数据都无法访问.

Working set is key here. For example, if you have a logging application outputting to MongoDB, it may be that your working set is the amount of data (and indexes) from the past 3 months and that all data before that you don't access.

当您的工作集超过RAM数量时,它将继续工作,但性能会明显下降,因为事情将不断地转移到性能低得多的磁盘上.如果您处于一台机器上超出RAM限制的情况,那么分片就在这里发挥作用-因此您可以平衡多台机器上的数据,从而增加了可保留在RAM中的数据量.

When your working set exceeds the amount of RAM, then it will carry on working but with noticeably degraded performance as things will then be constantly having to go to disk which is far less performant. If you're in this situation of exceeding RAM constraints on a machine, then this is where sharding comes into play - so you can balance the data out over a number of machines therefore increasing the amount of data that can be kept in RAM.

这篇关于当数据库大小大于RAM时,MongoDB可以工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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