mongodb mmap引擎文件页管理交由操作系统 mmap 来管理.
https://www.quora.com/How-is-a-read-query-processed-in-MongoDB
How is a read query processed in MongoDB?
Buffer pool
block size
Indexes
In MongoDb i saw only Indexes , But i am not able to find how mongoDB work with two cases (Bufferpool and Block) .Would any body please provide me links where i find how mongodb work for read and write ?
答:
In v3.0+, storage engines are pluggable, so the answer will depend on the storage engine.
With the legacy mmap storage engine, the first two things you mentions are auto-configured / implied by the virtual memory manager because of the use of mmap, so you don't have to specify anything there.
(phil 前两项都是由操作系统管理. 说明 mmap 引擎的索引保持的是文件的 offset .不然还得重新查询到 offset . 这个又 mysql 的 myisam 有点像. 不然就需要既要维护 mmap,又要维护 内容 page的存储结构, 用来 快速查询 id 对应的 offset )
innodb自己维护 pool ,操作系统维护 pool 的好处. 当然每个 page 缓存可能是跳过内核态的
As another example, you can find the configuration settings for the WildTiger storage engine here:Configuration File Options.
Regardless of storage engine there are indexes and conceptually this is similar to other databases.
WildTiger可以选择 btree 搜索和 lsm 索引
https://raw.githubusercontent.com/wiki/wiredtiger/wiredtiger/attachments/LSM_btree_Throughput.png
结论: wiredtiger 在 写并发(写锁占用)和内存占用上都远远优于了 mmap . rocket mq 最初也是用 mmap,当内存不够用时, 就会出现卡顿的现象. 原因?
https://stackoverflow.com/questions/37985134/how-to-choose-from-mmapv1-wiredtiger-or-in-memory-storageengine-for-mongodb