MongoDB Read/Write I/O Path

Hi Sebastian,

WiredTiger uses memory as a cache for all the data on the disk and the data in memory forms the current working set, overall it is similar to any key-value system will look like. It uses a least-recently-used algorithm to continuously moves data to disk that is currently not being accessed out of the memory to free up enough space to read data that are requested by the user but currently reside on the disk back into memory.

Consider two options while reading data from WiredTiger.

  • The data requested by MongoDB is in the WiredTiger cache.
    WiredTiger receives the request from MongoDB, iterate over the btree to find the page (requested information), and return the relevant value from the update chain.
  • The data requested by MongoDB is not in WiredTiger cache
    Suppose the requested information is not in the WiredTiger cache, then it has to search on-disk. If btree is not loaded then it gets the root page of the btree from on-disk, put in WiredTiger cache, traverses the btree’s internal pages to get the address (or disk address), load the page from on-disk to cache and gives the reference to MongoDB.

Cache management is a huge portion of WiredTiger. Can you be more specific on what you are looking for. ?

Thanks,
Ravi

3 Likes