Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you turn off MongoDB caching?

Tags:

mongodb

Can you turn off MongoDB cacheing? We are using Redis to store active data. We plan to use redis to hold this data in a normalized way while it is being used. One of the sources that passes data into redis is a mongodb instance.

Since we are using redis to keep the data in memory can we turn off mongos cacheing features?

Thanks!

like image 809
fancy Avatar asked Jan 19 '23 01:01

fancy


1 Answers

MongoDB uses memory-mapped I/O, this means that the OS caches the data not the datababase and it's not possible to turn this caching off.

The OS tipically uses least-recently-used algorithm to drop cache if memory is needed, so if you don't request old data from MongoDB those pages are going to be freed, which means it won't really interfere with Redis.

like image 114
Karoly Horvath Avatar answered Jan 29 '23 11:01

Karoly Horvath