Easy way to limit mongo memory usage?

yahiabakour
PRO

a year ago

Hey everyone,

I'm noticing a very high usage bill because i can't customize my machine max memory and can't limit mongo memory usage via the wiredtiger cache flags.

Any ideas?

Solved

7 Replies


yahiabakour
PRO

a year ago

@brody

  1. i wrote that other thread lol

  2. the solution doesnt work for long, it looked like it did because i restarted the db


a year ago

  1. Wow that funny at my expense.

  2. I assume that was a flag you appended to the start command?


yahiabakour
PRO

a year ago

yes, I've tried this before, doesn't seem to work long term:

--wiredTigerCacheSizeGB 5

a year ago

Could it be that mongo does simply need more memory?


yahiabakour
PRO

a year ago

I don't believe that's the case, it shouldn't need 30G+ of memory and runs fine with just a few GB and then slowly ramps up over the day.

With mongo im just running the default docker image without any modifications etc...

Ideally i'd love a way to limit machine memory instead of arbitrary 32GB limit.


a year ago

I get many many reports of Mongo crashing on the trial plan, so a container limit is likely not what you want since I can't imagine you would be okay with your database crashing every time it reaches 5GB.

Do some more research on how you would tell Mongo to use less memory, and I'd be happy to try and help you apply what you found to your database on Railway.


Status changed to Solved angelo 11 months ago