understand MongoDB cache system

前端 未结 2 1975
不知归路
不知归路 2020-12-07 22:47

This is a basic question, but very important, and i am not sure to really get the point.

On the official documentation we can read

MongoDB ke

2条回答
  •  一个人的身影
    2020-12-07 23:23

    MongoDB attempts to keep entire collections in memory: it memory-maps each collection page. For everything to be in memory, both the data pages, and the indices that reference them, must be kept in memory.

    If MongoDB returns a record, you can rest assured that it is now in memory (whether it was before your query or not).

    MongoDB doesn't keep a "cache" of records in the same way that, say, a web browser does. When you commit a change, both the memory and the disk are updated.

    Mongo is great when matched to the appropriate use cases. It is very high performance if you have sufficient server memory to cache everything, and declines rapidly past that point. Many, many high-volume websites use MongoDB: it's a good thing that memory is so cheap, now.

提交回复
热议问题