How to make Mongodb Indexes read and write from Local Storage and not RAM

I want my mongodb indexes to not be loaded/used by RAM. Instead I want them to work by reading and writing from Local Storage itself and not RAM.

Welcome to the MongoDB Community Forums @Shubham_Singh4!

The I/O performance of RAM is orders of magnitude faster than local storage, so all databases (not just MongoDB) generally require sufficient RAM to support common workloads for a deployment.

If performance is not a consideration, you could try minimising the amount of secondary indexes you create and limit available resources using containers or cgroups. However, you may be better served by a different solution optimised for low memory environments.

Can you elaborate on your use case for avoiding using RAM for indexes?



Thanks for your response @Stennie,
I actually want to try out a way in which indexes work without being loaded into RAM. All indexing operations must occur from the local storage only.

Hi @Shubham_Singh4,

I’m not aware of a database which completely avoids loading indexes into RAM as they are used. If limiting available resources (which will force the database server to swap to/from disk more regularly) doesn’t meet your testing scenario you perhaps want to look into an embedded solution or file-based library rather than a database server.

I still don’t understand the use case. Is this for an academic experiment?


Yeah it was for an academic experiment. Thanks for your help. Peace.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.