Optimal Mongo Performance

I need to run multi-threaded processes into Mongo to save data and use as little ram and swap as possible (this is not meteor specific - I’m using some node scripts I wrote)

What is the best way to do this? Is there are way to batch interactions or should I just try and throttle my scripts? Currently I get to around 6 threads and it’s max out my memory (16gb), I need to run around 12 threads - do I just have to add more memory or is there a way to make it run better? I’d like to make it run as lightweight as possible. Currently I am using replaceOne and upserts - is replaceMany better performance?

1 Like